2015-07-02 87 views

回答

0

當然。 Maven構建生命週期在phases中運行。您的插件可以配置爲在特定階段運行。

所以,你可以配置它在編譯階段或測試階段運行

示例配置插件phase的(在Maven的萬無一失,插件測試階段之前剛剛宣佈它):

<plugin> 
    <artifactId>maven-assembly-plugin</artifactId> 
    <version>2.5.5</version> 
    <configuration> 
     <descriptorRefs> 
     <descriptorRef>jar-with-dependencies</descriptorRef> 
     </descriptorRefs> 
    </configuration> 
    <executions> 
     <execution> 
     <id>make-assembly</id> <!-- this is used for inheritance merges --> 
     <phase>package</phase> <!-- bind to the packaging phase --> 
     <goals> 
      <goal>single</goal> 
     </goals> 
     </execution> 
    </executions> 
    </plugin>