我试图将此插件转换为pom to gradle。而且我已经补充道
依赖项中的compile 'org.codehaus.mojo:exec-maven-plugin:1.2.1'
。还有一些其他参数,如" includeProjectDependencies"等等。只是不知道还有什么东西可以放入" JavaExec":
task executeJava(type:JavaExec) {
main = "com.abc.efg.func.DocumentGenerator"
classpath = sourceSets.main.runtimeClasspath
dependsOn = files('/lib/tool.jar')
args = [
"--api_list",
"metaapi@v1",
"campaign@v1",
"--output_directory",
"$project.buildDir"
]
}
这是插件:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>com.abc.efg.func.DocumentGenerator</mainClass>
<executableDependency>
<groupId>com.google.template</groupId>
<artifactId>tool</artifactId>
</executableDependency>
<arguments>
<argument>--api_list</argument>
<argument>metaapi@v1,campaign@v1</argument>
<argument>--output_directory</argument>
<argument>${project.build.directory}</argument>
</arguments>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.template</groupId>
<artifactId>tool</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
</dependencies>
</plugin>