我有一个jar,build-plugins.jar和一个gradle插件,这个插件在build.gradle中用这个构建:
apply plugin 'java'
dependencies {
compile gradleApi()
compile localGroovy()
compile('eviware:maven-soapui-plugin:4.5.1')
compile('org.antlr:stringtemplate:4.0.2')
compile('commons-io:commons-io:2.4')
compile('joda-time:joda-time:2.1')
}
这将生成build-plugins.jar。使用插件的项目按文件引用插件jar
apply plugin 'thepluginwahoo'
buildscript {
dependencies {
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:2.2.1'
classpath files('/path/to/build-plugins.jar')
}
}
问题是当我运行第二个项目的任何任务时,我得到“无法为类xyz创建类代理”,其根本原因是四个依赖项(joda-time,commons-io,stringtemplate,maven-soapui-插件)不存在。如果我将依赖项添加到使用插件的项目中,则可以正常工作:
apply plugin 'thepluginwahoo'
buildscript {
dependencies {
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:2.2.1'
classpath files('/path/to/build-plugins.jar')
classpath 'eviware:maven-soapui-plugin:4.5.1'
classpath 'org.antlr:stringtemplate:4.0.2'
classpath 'joda-time:joda-time:2.1'
classpath 'commons-io:commons-io:2.4'
}
}
我的问题是,当jar包含在插件消耗项目的buildscript的类路径中时,为什么插件项目中“编译”依赖项的类不出现在插件消耗项目中。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句