2017-08-09 142 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)任務 –