gpt4 book ai didi

maven - 自定义Gradle插件找不到它自己的Maven依赖项

转载 作者:行者123 更新时间:2023-12-03 03:21:49 24 4
gpt4 key购买 nike

在我的项目中,我想包括一个使用自定义依赖项的gradle任务。
为此,我将编写一个自定义的gradle插件。

但是当我开始gradle时,显示以下错误:

A problem occurred configuring root project 'moduleUpdater'.
Could not resolve all dependencies for configuration ':classpath'.

Could not find org.example.plugin:MyJavaPlugin:1.0-SNAPSHOT.

Searched in the following locations:
.../moduleUpdater/repo/org/example/plugin/MyJavaPlugin/1.0-SNAPSHOT/maven-metadata.xml
.../moduleUpdater/repo/org/example/plugin/MyJavaPlugin/1.0-SNAPSHOT/MyJavaPlugin-1.0-SNAPSHOT.pom
.../moduleUpdater/repo/org/example/plugin/MyJavaPlugin/1.0-SNAPSHOT/MyJavaPlugin-1.0-SNAPSHOT.jar

Required by:
:moduleUpdater:unspecified

问题是自定义gradle插件的maven依赖关系未添加到主rootProject中。

我使用了一个教程,就像:
Creating a Gradle Custom Plugin with Java

http://www.javacodegeeks.com/2012/08/gradle-custom-plugin.html

以下教程制作了一个项目,就像它在git-repository上一样:
https://github.com/rakeshcusat/Code4Reference/tree/master/GradleExample/custom-plugin-1

但是,如果我尝试在给定存储库的“用户”文件夹中运行“渐变任务”,则仍然会收到相同的消息:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'user'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not find com.code4reference:code4ReferencePlugin:1.1-SNAPSHOT.
Searched in the following locations:
.../Code4Reference-master/GradleExample/custom-plugin-1/repo/com/code4reference/code4ReferencePlugin/1.1-SNAPSHOT/maven-metadata.xml
.../Code4Reference-master/GradleExample/custom-plugin-1/repo/com/code4reference/code4ReferencePlugin/1.1-SNAPSHOT/code4ReferencePlugin-1.1-20120816.164441-5.pom
.../Code4Reference-master/GradleExample/custom-plugin-1/repo/com/code4reference/code4ReferencePlugin/1.1-SNAPSHOT/code4ReferencePlugin-1.1-20120816.164441-5.jar
Required by:
:user:unspecified

它如何告诉gradle自动创建插件的Maven存储库(使用同一任务)?

最佳答案

我在回答您发布的github链接,因为我们没有您的代码。
user项目使用该插件,但是必须先构建该插件并将其部署到../repo,然后才能使用它。首先进入plugin项目并运行

gradle install

这将构建插件并在 ../repo文件夹中创建一个Maven存储库

关于maven - 自定义Gradle插件找不到它自己的Maven依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34965097/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com