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