2017-05-26 65 views
0

我嘗試使用Checksum Maven Plugin生成校驗文件大會插件組裝起來的分佈。不幸的是,試圖還計算校驗和target/classes目錄,當然失敗,因爲它是空的。力的Maven不產生目標/ classes目錄

除了黑客攻擊之外,還有一種方法可以抑制創建target/classestarget/test-classes

校驗和Maven插件的當前配置如下:

<plugin> 
    <groupId>net.nicoulaj.maven.plugins</groupId> 
    <artifactId>checksum-maven-plugin</artifactId> 
    <executions> 
     <execution> 
      <goals> 
       <goal>artifacts</goal> 
      </goals> 
     </execution> 
    </executions> 
    <configuration> 
     <algorithms> 
      <algorithm>MD5</algorithm> 
      <algorithm>SHA-1</algorithm> 
      <algorithm>SHA-256</algorithm> 
     </algorithms> 
    </configuration> 
</plugin> 
+0

什麼是您當前的插件配置?你能請分享相關的POM部分。 – nullpointer

+0

@nullpointer我增加了插件的配置。我想要生成校驗和的工件由Maven Assembly Plugin構建。 – Oliver

+0

什麼命令你執行的,什麼是你得到的錯誤?如果你能分享日誌,那會很好。嘗試在即使是空模塊上使用相同的配置也能成功執行。 – nullpointer

回答

1

使用files目標。

上面的例子將產生用於在目錄目標中的所有文件(由屬性$ {project.build.directory}表示)的校驗和。

要運行,使用目標net.nicoulaj.maven.plugins:校驗和Maven的插件:1.5:文件

我用一個組件神器Maven項目進行測試。我可以從你的問題中重現問題。我也測試了這個解決方案,它工作!

<plugin> 
    <groupId>net.nicoulaj.maven.plugins</groupId> 
    <artifactId>checksum-maven-plugin</artifactId> 
    <executions> 
     <execution> 
      <goals> 
       <goal>files</goal> 
      </goals> 
     </execution> 
    </executions> 
    <configuration> 
     <fileSets> 
      <fileSet> 
       <directory>${project.build.directory}</directory> 
      </fileSet> 
     </fileSets> 
     <algorithms> 
      <algorithm>MD5</algorithm> 
      <algorithm>SHA-1</algorithm> 
      <algorithm>SHA-256</algorithm> 
     </algorithms> 
    </configuration> 
</plugin> 
相關問題