Uploaded image for project: 'Maven Dependency Plugin'
  1. Maven Dependency Plugin
  2. MDEP-595

Maven 3.5.2 introduces intermittent test-jar dependency failures in multi-module builds

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • None
    • None
    • resolve
    • None
    • Windows 7 / Server 2012
      Maven 3.5.2
      JDK 1.8
      maven-jar-plugin 2.6
      maven-dependency-plugin 2.10 & 3.0.2

    Description

      This issue never presented in 6 months of running a multi-module build on Maven 3.2.5. It began to present in Maven 3.5.2.

      As it's intermittent, will obviously be difficult to reproduce, but here is a knocked-down version of our project:

      • parent-aggregator
        • project_a
        • project_b
          • builds jar and test-jar

      Project B has following pom snippet:

      			<plugin>
      				<groupId>org.apache.maven.plugins</groupId>
      				<artifactId>maven-jar-plugin</artifactId>
      				<executions>
      					<execution>
      						<goals>
      							<goal>test-jar</goal>
      						</goals>
      					</execution>
      				</executions>
      			</plugin>
      

      Project A has a <type>test-jar</type> on Project B. The dependency declaration is as follows

      <dependency>
        <groupId>mygroup</groupId>
        <artifactId>projectB</artifactId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope
      </dependency>
      

      Using Maven 3.2.5, the dependency had been declared using <classifier>tests</classifier> and this worked fine. Following a recommendation on this page: https://stackoverflow.com/questions/1725476/maven-test-dependency-in-multi-module-project which refers to the previous editions of the guide suggesting classifier, I switched to '<type>' but still have the same intermittent issue.

      This page suggests that using 'test-jar' is supported but not ideal: https://maven.apache.org/plugins/maven-jar-plugin/examples/create-test-jar.html

      Should we expect multi-module builds to work with test-jar dependencies or should we be using a separate 'tests' module instead?

      Attachments

        Activity

          People

            Unassigned Unassigned
            beirtipol@gmail.com Beirtí Ó'Nunáin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: