Maven JAR Plugin
  1. Maven JAR Plugin
  2. MJAR-68

multi module release fails because of test-jar

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      maven 2.0.5
    • Number of attachments :
      0

      Description

      The release plugin is failing in the prepare task

      mvn release:prepare

      seemingly because it can't find the test-jar that has just been built by the previous module i.e. built within.

      Are there some examples in the wild of using the test-jar on a multi module project that does releases?

      The (nasty) workaround I have for now, is to wait for the build to fail and then

      mvn install

      So the test-jar (and other artifacts) are in my local repository and then continue

      mvn release:prepare

        Issue Links

          Activity

          Hide
          Dan Batten added a comment -

          I'm having the same problem and the only "solution" I've found is the one mentioned above.

          Show
          Dan Batten added a comment - I'm having the same problem and the only "solution" I've found is the one mentioned above.
          Hide
          Dan Batten added a comment -

          After a bit more reading I found that there is a configuration parameter called preparationGoals. The default is "clean integration-test" but you can change this to the goals you want. I used "clean install" to fix the problem.

          Show
          Dan Batten added a comment - After a bit more reading I found that there is a configuration parameter called preparationGoals. The default is "clean integration-test" but you can change this to the goals you want. I used "clean install" to fix the problem.
          Hide
          Stephen Cooper added a comment - - edited

          The preparationGoals doesn't work for me. I have to use the ugly workaround mentioned in the description.

          Show
          Stephen Cooper added a comment - - edited The preparationGoals doesn't work for me. I have to use the ugly workaround mentioned in the description.
          Hide
          Stephen Cooper added a comment -

          Ah! I was able to make the preparationGoals work-around work for me by putting that configuration setting in the parent POM. I was putting it only in the POM where the test-jar configuration was specified.

          Show
          Stephen Cooper added a comment - Ah! I was able to make the preparationGoals work-around work for me by putting that configuration setting in the parent POM . I was putting it only in the POM where the test-jar configuration was specified.
          Hide
          Dan Batten added a comment -

          just checked and I also put the configuration in the parent POM.

          Show
          Dan Batten added a comment - just checked and I also put the configuration in the parent POM.
          Hide
          Chad Lyon added a comment -

          The problem is actually in the resolution of dependencies. I have a multi-module project. The project packages up a test JAR in the first module in the reactor order. This JAR is needed by the tests of the other modules. If my local repository is clean and I try to build while specifying -Dmaven.test.skip=true then two things happen that cause the build to fail:

          -The building of the test JAR is skipped because tests are skipped.
          -Skipping of tests does not instruct the dependency resolver for the other modules to NOT download the test JAR of the first module.

          Thus, I must first get the test-jar packaged up and in my local repo before my build can succeed. I can either run with tests or specify -Dmaven.test.execute=false

          I think the proper fix for this would be to fix the resolution of dependencies. Basically, if tests are skipped then don't check for deps that are scope=test.

          This problem seems to be related to MJAR-90. I bet before this fix went in this issue didn't exist.

          Show
          Chad Lyon added a comment - The problem is actually in the resolution of dependencies. I have a multi-module project. The project packages up a test JAR in the first module in the reactor order. This JAR is needed by the tests of the other modules. If my local repository is clean and I try to build while specifying -Dmaven.test.skip=true then two things happen that cause the build to fail: -The building of the test JAR is skipped because tests are skipped. -Skipping of tests does not instruct the dependency resolver for the other modules to NOT download the test JAR of the first module. Thus, I must first get the test-jar packaged up and in my local repo before my build can succeed. I can either run with tests or specify -Dmaven.test.execute=false I think the proper fix for this would be to fix the resolution of dependencies. Basically, if tests are skipped then don't check for deps that are scope=test. This problem seems to be related to MJAR-90 . I bet before this fix went in this issue didn't exist.
          Hide
          Chad Lyon added a comment -

          clarification... to skip executing tests but still compile them the switch is -DskipTests=true not -Dmaven.test.execute=false

          Also, my initial comment might warrant its own bug. What do you think?

          Show
          Chad Lyon added a comment - clarification... to skip executing tests but still compile them the switch is -DskipTests=true not -Dmaven.test.execute=false Also, my initial comment might warrant its own bug. What do you think?
          Hide
          nicolas de loof added a comment -

          -Dmaven.test.skip=true skips all test-related : compile test, run test, create test-jars ...

          -Dmaven.test.skip.exec=true only skip test execution. They are still compiled and packaged into test-jar.

          Show
          nicolas de loof added a comment - -Dmaven.test.skip=true skips all test-related : compile test, run test, create test-jars ... -Dmaven.test.skip.exec=true only skip test execution. They are still compiled and packaged into test-jar.
          Hide
          Chad Lyon added a comment -

          right, but do you agree that in a multi-module project if you are skipping tests (which includes skipping the build of the test JAR) then your modules that rely on that test JAR to run their tests won't need the test JAR and therefore should not fail with a "Missing dependency" (namely that test JAR)?

          The reason they should not fail is because they aren't running tests!!! I'm saying that the problem here is that in a sub-module POM if I specify:

          <scope>test</scope>

          for a dependency and then I skip tests then that dep should not even be checked for.

          Show
          Chad Lyon added a comment - right, but do you agree that in a multi-module project if you are skipping tests (which includes skipping the build of the test JAR) then your modules that rely on that test JAR to run their tests won't need the test JAR and therefore should not fail with a "Missing dependency" (namely that test JAR)? The reason they should not fail is because they aren't running tests!!! I'm saying that the problem here is that in a sub-module POM if I specify: <scope>test</scope> for a dependency and then I skip tests then that dep should not even be checked for.
          Hide
          Michael added a comment -

          I agree with Chad. We just ran into this problem. Any update? For now we're using maven.skip.exec=true.

          Show
          Michael added a comment - I agree with Chad. We just ran into this problem. Any update? For now we're using maven.skip.exec=true.
          Hide
          werner mueller added a comment -

          as mentioned above you can do a release with different preparation goals:

          $ mvn release:prepare -DpreparationGoals="clean install"
          $ mvn release:perform

          this is still a workaround but well it works (creating the test-jar and execute tests in depending modules)

          Show
          werner mueller added a comment - as mentioned above you can do a release with different preparation goals: $ mvn release:prepare -DpreparationGoals="clean install" $ mvn release:perform this is still a workaround but well it works (creating the test-jar and execute tests in depending modules)
          Hide
          Dennis Lundberg added a comment -

          We set <type>test-jar</type> on a dependency on a test jar.

          Show
          Dennis Lundberg added a comment - We set <type>test-jar</type> on a dependency on a test jar.
          Hide
          Archimedes Trajano added a comment - - edited

          This works well on 3.0.3

          Show
          Archimedes Trajano added a comment - - edited This works well on 3.0.3
          Hide
          Michael Osipov added a comment -

          Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

          Show
          Michael Osipov added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

            People

            • Assignee:
              Unassigned
              Reporter:
              Yuri Schimke
            • Votes:
              7 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: