【发布时间】:2013-07-17 12:01:18
【问题描述】:
我正在尝试强制 checkstyle 插件使用存储在不同 jar 文件中的 xml 配置(作为依赖项)。
我创建了一个仅包含该配置文件的包。
在 build.gradle 我有以下配置:
apply plugin: 'checkstyle'
checkstyle {
checkstyleMain {
classpath += configurations.checkstyleDep
}
checkstyleTest {
classpath += configurations.checkstyleDep
}
configFile = new File(getClass().getResource("/checkstyle.xml").toURI())
println(configFile)
}
configurations {
checkstyleDep
}
dependencies {
checkstyleDep "com.example:checkstyle-common:1.0"
}
不幸的是,这不会导致 gradle 看到依赖项。
我的代码有什么问题?有没有更好的方法来做到这一点?
【问题讨论】:
-
'com.example:checkstyle-common:1.0' jar 在您的存储库中可用吗?
-
是的,它是 - 我已将它放入本地 maven repo 并正确下载。
-
您是否尝试将其添加为 buildscript 依赖项?
标签: java gradle build.gradle