2015-11-19 72 views
2

我正在使用maven-install-plugin來生成我的.war文件的校驗和,但它們保存在我的本地maven倉庫中。Maven,在目標(build)目錄中保存校驗和文件

<plugin> 
    <artifactId>maven-install-plugin</artifactId> 
    <version>2.3.1</version> 
    <configuration> 
     <createChecksum>true</createChecksum> 
    </configuration> 
    </plugin> 

我需要什麼:

1)我的目標構建目錄保存校驗文件,而不是。

2)將生成的校驗和文件從目標構建目錄複製到另一個位置(使用maven-dependency-plugin?)。

回答

0

我在做類似的東西 - 這裏是我當前如何做它:

要生成校驗和,我現在用的是校驗和Maven的插件。 這是一個pom.xml代碼片段,它將在您的目標/目錄中爲它在其中找到的所有.war文件生成.sha1校驗和文件。 您可以調整<includes/>規範以更改哪些文件進行校驗和,您可以調整<algorithms/>規範以指定使用哪種校驗和算法。

<plugin> 
    <groupId>net.ju-n.maven.plugins</groupId> 
    <artifactId>checksum-maven-plugin</artifactId> 
    <version>1.3</version> 
    <executions> 
     <execution> 
     <id>checksum-maven-plugin-files</id> 
     <phase>package</phase> 
     <goals> 
      <goal>files</goal> 
     </goals> 
     </execution> 
    </executions> 
    <configuration> 
     <fileSets> 
     <fileSet> 
      <directory>${project.build.directory}</directory> 
      <includes> 
      <include>*.war</include> 
      </includes> 
     </fileSet> 
     </fileSets> 
     <algorithms> 
     <algorithm>SHA-1</algorithm> 
     </algorithms> 
    </configuration> 
    </plugin> 

從目標目錄中的其他位置生成校驗和的複製可以做多種方式,我想我需要您的使用更加位信息推薦的解決方案 - 你可以給你如何更多細節計劃使用校驗和文件以及它們在構建層次結構中的位置?

參考文獻:

http://nicoulaj.github.io/checksum-maven-plugin/

How do you create a checksum in Maven then output it to a text file?