2017-08-09 145 views
-1

我需要在gradle项目中使用下面的maven插件。请给一些想法如何转换为gradle?转换maven插件exec-maven插件gradle

<plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>exec-maven-plugin</artifactId> 
      <version>${exec-maven-plugin.version}</version> 
      <executions> 
       <execution> 
        <id>main</id> 
        <goals> 
         <goal>java</goal> 
        </goals> 
       </execution> 
       <execution> 
        <id>test</id> 
        <phase>package</phase> 
        <goals> 
         <goal>exec</goal> 
        </goals> 
        <configuration> 
         <executable>make</executable> 
         <arguments> 
          <argument>test</argument> 
         </arguments> 
        </configuration> 
       </execution> 
      </executions> 
      <configuration> 
       <mainClass>com.service.main.TWAService</mainClass> 
      </configuration> 
     </plugin> 

请给我一些想法,我可以在gradle中做什么。

回答

1
task runTwaService(type: JavaExec) { 
    main = 'com.service.main.TWAService' 
    classpath = sourceSets.main.runtimeClasspath 
} 
+0

从这个任务,我需要发送,使文件。我该怎么办? –

+0

要调用java类中的'main'方法,请使用[JavaExec](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html)。要从命令行调用进程(例如'make'),然后使用[Exec](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Exec.html)任务 –