Uploaded image for project: '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
    • Status: Closed
    • Priority: 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

      Description

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

        Issue Links

          Activity

          Hide
          asafm Asaf Mesika added a comment -

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

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

          Show
          asafm Asaf Mesika added a comment - maven.test.skip.exec is deprecated I think. You should use -DskipTests. Does the same thing, but shorter.
          Hide
          ndeloof 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
          ndeloof 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
          clyon 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
          clyon 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
          ndeloof 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
          ndeloof 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
          clyon Chad Lyon added a comment -

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

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

          Fixed at revision: 604458

          Show
          ndeloof nicolas de loof added a comment - Fixed at revision: 604458
          Hide
          wsmoak 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
          wsmoak Wendy Smoak added a comment - What behavior do you expect to see? Should the test jar not get generated at all in this situation?

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development