将maven插件exec-maven-plugin转换为gradle

时间:2017-08-09 13:00:49

标签: java maven gradle

我需要在gradle项目中使用以下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 个答案:

答案 0 :(得分:1)

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