【问题标题】:How can I build a Gradle plugin with Maven如何使用 Maven 构建 Gradle 插件
【发布时间】:2014-12-18 20:57:56
【问题描述】:

可以使用 Maven 构建 Gradle 插件。需要哪些依赖?

【问题讨论】:

    标签: maven gradle


    【解决方案1】:

    是的,这是可能的。我们使用这些依赖项对Spring Boot's Gradle plugin 执行此操作:

    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.gradle</groupId>
        <artifactId>gradle-core</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.gradle</groupId>
        <artifactId>gradle-base-services</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.gradle</groupId>
        <artifactId>gradle-base-services-groovy</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.gradle</groupId>
        <artifactId>gradle-plugins</artifactId>
        <scope>provided</scope>
    </dependency>
    

    Groovy 在 Maven Central 中,但 Gradle 依赖项在它们自己的存储库中:http://repo.gradle.org/gradle/libs-releases-local

    【讨论】:

    • 我看到您最近(2017 年 3 月)switched 从一个全 Maven 构建到一个“Maven 调用 Gradle”变体。您能否详细说明原因。 (我问是因为我也想用 Maven 构建一个 Gradle 插件,但是在 repo.gradle.org 的任何 Maven 存储库中都找不到像 org.gradle.api.tasks.SourceSet 这样的类型。你遇到过类似的问题吗?)
    • 有几个原因。我们想要依赖的一些类型不在 Gradle 存储库中的模块中。下载 Gradle 发行版,提取我们需要的 jar 并将它们发布到我们自己的某个地方是一件很痛苦的事情。事实证明,使用 TestKit(太棒了)几乎是不可能的。到目前为止,新方法运行良好。我会推荐它。
    猜你喜欢
    • 1970-01-01
    • 2023-03-19
    • 2014-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-12
    • 1970-01-01
    相关资源
    最近更新 更多