Aw: Re: maven-enforcer-plugin problems with test dependency in multi module project
Without the maven enforce rule “requireReleaseDeps” and without the typetest-jar/type in the pom.xml of the test-child “mvn clean package” failed as predicted. Without the maven enforce rule “requireReleaseDeps” and with the typetest-jar/type “mvn clean package” and “mvn clean compile” succeeded. With the maven enforce rule “requireReleaseDeps” and with the typetest-jar/type in the pom.xml of the test-child “mvn clean package” succeeded but “mvn clean compile” failed because of the missing test:test-parent:jar:tests. But since the scope is set scopetest/scope this shouldn't matter, should it? Best regards Matthias Gesendet: Donnerstag, 30. Januar 2014 um 17:13 Uhr Von: Karl Heinz Marbaise khmarba...@gmx.de An: users@maven.apache.org Betreff: Re: maven-enforcer-plugin problems with test dependency in multi module project Hi, based on the error message you have a dependency on your test-jar project but you defined the dependency a little bit wrong: test:test-child:jar:1.0.0: Failure to find test:test-parent:jar:tests:1.0.0 This shows that you have defined a dependency in the test-parent but like this: dependencies dependency groupIdtest/groupId artifactIdtest-parent/artifactId version1.0-SNAPSHOT/version scopetest/scope /dependency /dependencies BUT you have to give the type in this case like this: dependencies dependency groupIdtest/groupId artifactIdtest-parent/artifactId version1.0-SNAPSHOT/version typetest-jar/type scopetest/scope /dependency /dependencies Best test is to comment out the maven-enforcer-rule and try to build your project just from the parent via mvn clean package I assume in your case without the above fix your project will not build. If it will you need to clean out your local repository first and retry it... Kind regards Karl Heinz Marbaise Hi, I have a multi-module-project with one module that implements classes for testing (test-parent) and another module (test-child) that uses theses classes. There is a dependency in test scope from the test-child to the test-parent. (See article http://stackoverflow.com/questions/1725476/maven-test-dependency-in-multi-module-project and http://maven.apache.org/guides/mini/guide-attached-tests.html[http://maven.apache.org/guides/mini/guide-attached-tests.html]) The pom of the depending test-child contains the following code: dependencies dependency groupIdtest/groupId artifactIdtest-parent/artifactId version1.0-SNAPSHOT/version typetest-jar/type scopetest/scope /dependency /dependencies The test-parent module that contains the derived classes contains the following code: plugins plugin artifactIdmaven-jar-plugin/artifactId version2.2/version executions execution goals goaltest-jar/goal /goals phasetest-compile/phase /execution /executions /plugin /plugins In a parent pom the maven-enforcer-plugin is included and the RequireReleaseDeps rule is added to the list of rules. While running the Maven goal “compile” the project compilation of the test-child fails with the following message: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce (default) on project test-child: Execution default of goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce failed: org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException: Could not resolve dependencies for project test:test-child:jar:1.0.0: Failure to find test:test-parent:jar:tests:1.0.0 It seems that Maven checks the dependencies of type and scope “test” in the compile phase. In the case the test-jar is build in the test-compile and is not present yet. This leads to the error. If I remove the RequireReleaseDeps from the rules it works fine. Here is the simplified config of the maven-enforcer-plugin: pluginManagement plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-enforcer-plugin/artifactId version${maven-enforcer-plugin.version}/version inheritedtrue/inherited executions execution goalsgoalenforce/goal/goals /execution /executions configuration !-- skip/ -- rules requireReleaseDeps onlyWhenReleasefalse/onlyWhenRelease /requireReleaseDeps requireMavenVersion version[3.0.4,]/version /requireMavenVersion /rules fail${maven-enforcer-plugin.fail}/fail /configuration /plugin /plugins /pluginManagement plugins plugin groupIdorg.apache.maven.plugins
maven-enforcer-plugin problems with test dependency in multi module project
Hi, I have a multi-module-project with one module that implements classes for testing (test-parent) and another module (test-child) that uses theses classes. There is a dependency in test scope from the test-child to the test-parent. (See article http://stackoverflow.com/questions/1725476/maven-test-dependency-in-multi-module-project and http://maven.apache.org/guides/mini/guide-attached-tests.html[http://maven.apache.org/guides/mini/guide-attached-tests.html]) The pom of the depending test-child contains the following code: dependencies dependency groupIdtest/groupId artifactIdtest-parent/artifactId version1.0-SNAPSHOT/version typetest-jar/type scopetest/scope /dependency /dependencies The test-parent module that contains the derived classes contains the following code: plugins plugin artifactIdmaven-jar-plugin/artifactId version2.2/version executions execution goals goaltest-jar/goal /goals phasetest-compile/phase /execution /executions /plugin /plugins In a parent pom the maven-enforcer-plugin is included and the RequireReleaseDeps rule is added to the list of rules. While running the Maven goal “compile” the project compilation of the test-child fails with the following message: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce (default) on project test-child: Execution default of goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce failed: org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException: Could not resolve dependencies for project test:test-child:jar:1.0.0: Failure to find test:test-parent:jar:tests:1.0.0 It seems that Maven checks the dependencies of type and scope “test” in the compile phase. In the case the test-jar is build in the test-compile and is not present yet. This leads to the error. If I remove the RequireReleaseDeps from the rules it works fine. Here is the simplified config of the maven-enforcer-plugin: pluginManagement plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-enforcer-plugin/artifactId version${maven-enforcer-plugin.version}/version inheritedtrue/inherited executions execution goalsgoalenforce/goal/goals /execution /executions configuration !-- skip/ -- rules requireReleaseDeps onlyWhenReleasefalse/onlyWhenRelease /requireReleaseDeps requireMavenVersion version[3.0.4,]/version /requireMavenVersion /rules fail${maven-enforcer-plugin.fail}/fail /configuration /plugin /plugins /pluginManagement plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-enforcer-plugin/artifactId /plugin /plugins /build Is this behavior of the maven-enforcer-plug-in correct? If so, is there a way to work around it? Matthias - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: maven-enforcer-plugin problems with test dependency in multi module project
Hi, based on the error message you have a dependency on your test-jar project but you defined the dependency a little bit wrong: test:test-child:jar:1.0.0: Failure to find test:test-parent:jar:tests:1.0.0 This shows that you have defined a dependency in the test-parent but like this: dependencies dependency groupIdtest/groupId artifactIdtest-parent/artifactId version1.0-SNAPSHOT/version scopetest/scope /dependency /dependencies BUT you have to give the type in this case like this: dependencies dependency groupIdtest/groupId artifactIdtest-parent/artifactId version1.0-SNAPSHOT/version typetest-jar/type scopetest/scope /dependency /dependencies Best test is to comment out the maven-enforcer-rule and try to build your project just from the parent via mvn clean package I assume in your case without the above fix your project will not build. If it will you need to clean out your local repository first and retry it... Kind regards Karl Heinz Marbaise Hi, I have a multi-module-project with one module that implements classes for testing (test-parent) and another module (test-child) that uses theses classes. There is a dependency in test scope from the test-child to the test-parent. (See article http://stackoverflow.com/questions/1725476/maven-test-dependency-in-multi-module-project and http://maven.apache.org/guides/mini/guide-attached-tests.html[http://maven.apache.org/guides/mini/guide-attached-tests.html]) The pom of the depending test-child contains the following code: dependencies dependency groupIdtest/groupId artifactIdtest-parent/artifactId version1.0-SNAPSHOT/version typetest-jar/type scopetest/scope /dependency /dependencies The test-parent module that contains the derived classes contains the following code: plugins plugin artifactIdmaven-jar-plugin/artifactId version2.2/version executions execution goals goaltest-jar/goal /goals phasetest-compile/phase /execution /executions /plugin /plugins In a parent pom the maven-enforcer-plugin is included and the RequireReleaseDeps rule is added to the list of rules. While running the Maven goal “compile” the project compilation of the test-child fails with the following message: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce (default) on project test-child: Execution default of goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce failed: org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException: Could not resolve dependencies for project test:test-child:jar:1.0.0: Failure to find test:test-parent:jar:tests:1.0.0 It seems that Maven checks the dependencies of type and scope “test” in the compile phase. In the case the test-jar is build in the test-compile and is not present yet. This leads to the error. If I remove the RequireReleaseDeps from the rules it works fine. Here is the simplified config of the maven-enforcer-plugin: pluginManagement plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-enforcer-plugin/artifactId version${maven-enforcer-plugin.version}/version inheritedtrue/inherited executions execution goalsgoalenforce/goal/goals /execution /executions configuration !-- skip/ -- rules requireReleaseDeps onlyWhenReleasefalse/onlyWhenRelease /requireReleaseDeps requireMavenVersion version[3.0.4,]/version /requireMavenVersion /rules fail${maven-enforcer-plugin.fail}/fail /configuration /plugin /plugins /pluginManagement plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-enforcer-plugin/artifactId /plugin /plugins /build - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org