1
我有一個Maven項目,它使用exec-maven-plugin
來執行一個帶有main方法的類,並且這會在目標目錄中生成一個輸出文件。配置是這樣的:Maven:如何打包和部署由main()方法執行生成的輸出文件?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>process-execution</id>
<phase>package</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.example.MainClass</mainClass>
<systemProperties>
<systemProperty>
<key>INPUT_FILE_PATH</key>
<value>${basedir}/src/main/resources/input_file.csv</value>
</systemProperty>
<systemProperty>
<key>OUTPUT_FILE_PATH</key>
<value>${project.build.directory}/output_file.json</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
我希望能夠打包和部署此輸出文件(output_file.json)
作爲一個單獨的jar的包庫與工程類建設標準的jar文件一起。
有沒有辦法做到這一點?或許與maven-assembly-plugin
?
聽起來像是你應該創建一個Maven插件和整合,在構建過程......此外添加一個文件到您的結果被打包你可以通過使用[buildhelper-maven-plugin]來實現(http://www.mojohaus.org/build-helper-maven-plugin/usage.html)。這取決於您當前項目的包裝類型? (罐子/戰爭?) – khmarbaise