Maven skip tests

后端 未结 8 2133
攒了一身酷
攒了一身酷 2020-12-12 09:10

I am using Maven 2.2.1 and to build my project I used this command

mvn clean install -Dmaven.test.skip=true

However, the build failed sayin

8条回答
  •  离开以前
    2020-12-12 09:42

    As you noted, -Dmaven.test.skip=true skips compiling the tests. More to the point, it skips building the test artifacts. A common practice for large projects is to have testing utilities and base classes shared among modules in the same project.

    This is accomplished by having a module require a test-jar of a previously built module:

    
      org.myproject.mygroup
      common
      1.0
      test-jar
      test
    
    

    If -Dmaven.test.skip=true (or simply -Dmaven.test.skip) is specified, the test-jars aren't built, and any module that relies on them will fail its build.

    In contrast, when you use -DskipTests, Maven does not run the tests, but it does compile them and build the test-jar, making it available for the subsequent modules.

提交回复
热议问题