自定义Gradle插件jar - 向类路径添加瞬态依赖项

时间:2018-03-21 23:34:20

标签: gradle android-gradle gradle-plugin

我创建了一个具有瞬态依赖关系的自定义gradle插件。该插件工作正常,我正在将档案输出到本地maven仓库,这一切都工作正常。输出目录包含pom和jar文件。

我希望能够在不依赖本地存储库的情况下在项目之间分发插件,而无需设置远程私有存储库。这里显而易见的选择是在项目之间解析jar文件,但是这需要我手动将插件的瞬态依赖项添加到项目的类路径中。

我的问题是如何将gradle插件作为jar分发,并将其包含在瞬态依赖项中,而无需手动将这些依赖项添加到新的项目类路径中?

如果不添加到类路径,我会看到以下错误:

Error:(4, 0) Unable to load class 'x'.
Possible causes for this unexpected error include: Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.).
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. 
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project. In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

0 个答案:

没有答案
相关问题