我如何才能使 Maven 模块仅在父部署时进入测试阶段?
How can I make a Maven module only go until the test phase when the parent gets deployed?
我正在处理一个多模块项目。我们的模块之一是 tests
项目,它测试其他模块。
第一个问题:这是一个很好的练习吗?
Maven 构建生命周期阶段是:
validate
compile
test
package
integration-test
verify
install
deploy
安装或部署父模块时,如何让tests
模块只执行到test
阶段,即跳过包和后续阶段?由于此模块的唯一目的是测试其他模块。
我认为这是一个 jar
项目。看看Plugin Bindings for Default Lifecycle Reference。
将 maven-jar-plugin
、maven-install-plugin
和 maven-deploy-plugin
插件的默认执行绑定到 pom.xml
中的 none
阶段
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>default-install</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
我正在处理一个多模块项目。我们的模块之一是 tests
项目,它测试其他模块。
第一个问题:这是一个很好的练习吗?
Maven 构建生命周期阶段是:
validate
compile
test
package
integration-test
verify
install
deploy
安装或部署父模块时,如何让tests
模块只执行到test
阶段,即跳过包和后续阶段?由于此模块的唯一目的是测试其他模块。
我认为这是一个 jar
项目。看看Plugin Bindings for Default Lifecycle Reference。
将 maven-jar-plugin
、maven-install-plugin
和 maven-deploy-plugin
插件的默认执行绑定到 pom.xml
none
阶段
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>default-install</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
</executions>
</plugin>