【问题标题】:Convert maven plugin exec-maven-plugin to gradle将 maven 插件 exec-maven-plugin 转换为 gradle
【发布时间】:2018-01-17 09:19:07
【问题描述】:

我需要在 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 中做些什么。

【问题讨论】:

    标签: java maven gradle


    【解决方案1】:
    task runTwaService(type: JavaExec) {
        main = 'com.service.main.TWAService'
        classpath = sourceSets.main.runtimeClasspath
    }
    

    【讨论】:

    • 从这个任务中我需要发送来制作文件。我该怎么办?
    • 要在 java 类中调用 main 方法,请使用 JavaExec。要从命令行调用进程(例如make),然后使用Exec 任务
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-25
    • 1970-01-01
    • 1970-01-01
    • 2016-01-31
    • 2016-01-28
    • 2015-12-13
    • 2015-06-13
    相关资源
    最近更新 更多