[ https://issues.apache.org/jira/browse/MJAR-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16160365#comment-16160365 ]
Bisser Peshev edited comment on MJAR-138 at 9/10/17 2:46 PM: ------------------------------------------------------------- Thank you for your response. Unfortunately, after adding the {color:#14892c}<skip>false</skip>{color} configuration, an empty test-jar was produced when maven.test.skip was true. Or rather, it only contained the manifest file, but no classes. This is not a solution. :( Yes, it's a maven-jar-plugin problem, because it doesn't create the test-jar. But Maven itself also takes part in the problem, because it enforces the dependencies on the test-jar, although they are not needed when maven.test.skip is true. But then again, probably it's not Maven's responsibility to decide which dependency is needed and which isn't, neither is it supposed to know about the maven.test.skip option. I suppose the simplest solution would be for maven-jar-plugin to stop checking the value of maven.test.skip and let the surefire plugin worry about that option. So, maven-jar-plugin will _always_ generate the test-jar. was (Author: blizzard): Thank you for your response. Unfortunately, after adding the {color:#14892c}<skip>false</skip>{color} configuration, an empty jar was produced when maven.test.skip was true. Or rather, it only contained the manifest file, but no classes. This is not a solution. :( Yes, it's a maven-jar-plugin problem, because it doesn't create the test-jar. But Maven itself also takes part in the problem, because it enforces the dependencies on the test-jar, although they are not needed when maven.test.skip is true. But then again, probably it's not Maven's responsibility to decide which dependency is needed and which isn't, neither is it supposed to know about the maven.test.skip option. I suppose the simplest solution would be for maven-jar-plugin to stop checking the value of maven.test.skip and let the surefire plugin worry about that option. So, maven-jar-plugin will _always_ generate the test-jar. > jar:test-jar is skipped when maven.test.skip=true > ------------------------------------------------- > > Key: MJAR-138 > URL: https://issues.apache.org/jira/browse/MJAR-138 > Project: Maven JAR Plugin > Issue Type: Improvement > Affects Versions: 2.3.1 > Environment: jar:test-jar > Reporter: Andrew Hughes > Fix For: more-investigation > > Attachments: MJAR-138-maven-jar-plugin.patch > > > Not sure if this is a bug or improvement... > Example: > * ./pom.xml > * ./moduleA/pom.xml > * ./moduleB/pom.xml > Situation: > * moduleA produces moduleA-1.2.3-test.jar with the jar:test-jar goal > * moduleB consumes moduleA-1.2.3-test.jar as a > <dependency>...<scope>test</scope><dependency> > Problem: > * When -Dmaven.test.skip=true the moduleA-1.2.3-test.jar is never built. > * Then when moduleB tries to build, it's moduleA-1.2.3-test.jar dependency is > unresolved. FAIL! Even with -Dmaven.test.skip=true this will fail. > You might argue that this is a bug with dependency resolution with > -Dmaven.test.skip=true - should a missing dependency @ test scope really fail > the build??? It probably should - which is why the bug is submitted here :) > I've no idea what could be done to fix this either? > --- > p.s. for anyone with this bug the only workaround I can suggest is running > another module... > ./moduleA-test/pom.xml > and have > <dependency>...<artifactId>moduleA-test<artifactId>...<scope>test</scope></dependency> -- This message was sent by Atlassian JIRA (v6.4.14#64029)