2010-07-18 33 views
3

我希望有人可以幫助我完成maven部署(通常通過發佈插件運行)。向標準maven部署中添加工件

我想在發佈時將除打包的jar以外的文件部署到repo,例如特定的指令文檔和生成的SQL文件。

這將是很好,如果我不必使用deploy:deploy-file爲每一個。如果我可以將每個文件添加到我的POM文件中的列表中,那麼這將是最好的,它會在發佈後自動爲我提取。

回答

8

可以使用Maven Assembly Plugin將它們打包到將被安裝/部署的程序集中。

或者使用attach-artifact目標build-helper plugin的:

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>build-helper-maven-plugin</artifactId> 
    <version>1.5</version> 
    <executions> 
    <execution> 
     <id>attach-artifacts</id> 
     <phase>package</phase> 
     <goals> 
     <goal>attach-artifact</goal> 
     </goals> 
     <configuration> 
     <artifacts> 
      <artifact> 
      <file>some file</file> 
      <type>extension of your file</type> 
      <classifier>optional</classifier> 
      </artifact> 
      ... 
     </artifacts> 
     </configuration> 
    </execution> 
    </executions> 
</plugin>