2015-05-20 150 views
0

這裏是pom.xml從我的項目maven配置文件配置集成階段執行在生命週期?

<profiles> 

      <profile> 
       <id>run-tests</id> 
       <build> 
        <plugins> 
         <plugin> 
          <groupId>com.google.code.maven-replacer-plugin</groupId> 
          <artifactId>replacer</artifactId> 
          <version>1.5.2</version> 
          <executions> 
           <execution> 
            <phase>pre-integration-test</phase> 
            <goals> 
             <goal>replace</goal> 
            </goals> 
           </execution> 
          </executions> 
          <configuration> 
           <includes> 
            ...... 
           </includes> 

           <replacements> 
            <replacement> 
             ....... 
            </replacement> 
           </replacements> 
          </configuration> 
         </plugin> 

        <plugin> 
          <groupId>org.apache.maven.plugins</groupId> 
          <artifactId>maven-failsafe-plugin</artifactId> 
          <version>2.18.1</version> 
          <configuration> 
           ...... 
          </configuration> 
          <executions> 
           <execution> 
            <goals> 
             <goal>integration-test</goal> 
             <goal>verify</goal> 
            </goals> 
            <phase>integration-test</phase> 
           </execution> 
          </executions> 
         </plugin> 
        </plugins> 
    </build> 
</profile> 
</profiles> 

冷凝段我有兩個問題:

1)當我執行mvn clean package -Prun-tests,會發生什麼?我預計這些插件目標都不會在這裏執行,因爲它們綁定到integration-test階段。但是我看到這些目標被執行爲什麼?

2)execution block有兩個目標是什麼意思?請參見上文中failsafe-plugin

感謝

回答

1

的部分答案:

1)沒有辦法。除非您還在主構建部分中配置了這些插件,以便在包裝中分階段運行。

你是怎麼確定的插件已經用完?在Maven輸出中是否有如下內容?

[INFO] ---行家故障安全-插件:2.18.1:集成測試(默認)

[INFO] ---行家故障安全-插件:2.18.1:驗證(默認)

2)這意味着兩個目標(mojos)將在集成測試階段執行。首先是集成測試目標,緊接着是驗證目標。

點評:集成測試的目標是默認綁定到集成測試階段,而驗證目標綁定到驗證階段。所以,你可能已經配置了故障安全插件這種方式:

<executions> 
     <execution> 
     <goals> 
      <goal>integration-test</goal> 
      <goal>verify</goal> 
     </goals> 
     </execution> 
    </executions> 

注意相位中省略

+0

什麼有'verify'無相的目標是什麼意思? –

+0

爲點1 - 你的意思是個人資料已經沒有影響,當運行'MVN清潔套裝-prun,tests'? –

+0

驗證目標不相指驗證目標運行在驗證階段(到其默認綁定) –

相關問題