簡體   English   中英

我怎樣才能讓 Maven 模塊只運行到父級部署的測試階段?

[英]How can I make a Maven module only go until the test phase when the parent gets deployed?

我正在做一個多模塊項目。 我們的模塊之一是tests項目,用於測試其他模塊。

第一個問題:這是一個好的做法嗎?

Maven 構建生命周期階段是:

  1. validate
  2. compile
  3. test
  4. package
  5. integration-test
  6. verify
  7. install
  8. deploy

在安裝或部署父模塊時,如何讓tests模塊只運行到test階段,即跳過包和后續階段? 由於此模塊的唯一目的是測試其他模塊。

我假設它是一個jar項目。 查看默認生命周期參考插件綁定

maven-jar-pluginmaven-install-pluginmaven-deploy-plugin插件的默認執行綁定到pom.xmlnone階段

<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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM