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

when maven.test.Skip is set, the test-jar artifact is empty

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      running any project with test-jar mojo
    • Number of attachments :
      0

      Description

      as maven.test.skip disable test compilation, the generated test-jar is empty.

        Issue Links

          Activity

          Hide
          Wendy Smoak added a comment -

          What behavior do you expect to see? Should the test jar not get generated at all in this situation?

          Show
          Wendy Smoak added a comment - What behavior do you expect to see? Should the test jar not get generated at all in this situation?
          Hide
          nicolas de loof added a comment -

          Fixed at revision: 604458

          Show
          nicolas de loof added a comment - Fixed at revision: 604458
          Hide
          Chad Lyon added a comment -

          This fix causes problems for multi-module projects. See MJAR-68

          Show
          Chad Lyon added a comment - This fix causes problems for multi-module projects. See MJAR-68
          Hide
          nicolas de loof added a comment -

          See comment on MJAR-68.

          There is no way (AFAIK) to avoid test-scope dependency resolution based on -Dmaven.test.skip=true.
          You should use -Dmaven.test.skip.exec=true to compile and package test, but not run them.

          Show
          nicolas de loof added a comment - See comment on MJAR-68 . There is no way (AFAIK) to avoid test-scope dependency resolution based on -Dmaven.test.skip=true. You should use -Dmaven.test.skip.exec=true to compile and package test, but not run them.
          Hide
          Chad Lyon added a comment -

          Then I think creating a blank JAR is a good thing. It will cause the dependency resolution to not fail when tests are skipped. Perhaps this fix should be rolled back.

          Show
          Chad Lyon added a comment - Then I think creating a blank JAR is a good thing. It will cause the dependency resolution to not fail when tests are skipped. Perhaps this fix should be rolled back.
          Hide
          nicolas de loof added a comment -

          A blank jar is never a good think. You will have a jar in your repo that is NOT what it is expected to be, and can introduce strange issues when you come back to your IDE. It also adds the risk to deploy an empty jar if your release goal includes "deploy".

          If you don't want to execute tests as part of the release process (I also do) simply set <arguments>-Dmaven.test.skip.exec</arguments> in your POM for the release plugin, or maybe in a parent corporate POM.

          Show
          nicolas de loof added a comment - A blank jar is never a good think. You will have a jar in your repo that is NOT what it is expected to be, and can introduce strange issues when you come back to your IDE. It also adds the risk to deploy an empty jar if your release goal includes "deploy". If you don't want to execute tests as part of the release process (I also do) simply set <arguments>-Dmaven.test.skip.exec</arguments> in your POM for the release plugin, or maybe in a parent corporate POM.
          Hide
          Asaf Mesika added a comment -

          maven.test.skip.exec is deprecated I think.

          You should use -DskipTests.
          Does the same thing, but shorter.

          Show
          Asaf Mesika added a comment - maven.test.skip.exec is deprecated I think. You should use -DskipTests. Does the same thing, but shorter.

            People

            • Assignee:
              nicolas de loof
              Reporter:
              nicolas de loof
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: