我正在尝试使用以下链接中的dependency.check,并且在按照给出的说明进行操作时(根本)无法使其正常运行。
https://github.com/jeremylong/DependencyCheck/tree/master/dependency-check-gradle
尝试使用应用插件和其他依赖项进行构建时,启动失败并引发以下错误。
其中:构建文件“/Users/aaron/work/backups/eiss/build.gradle”行:25
出了什么问题:评估根项目“eiss”时出现问题。无法应用插件 [id 'dependency.check'] 未找到 ID 为 'dependency.check' 的插件。
在进行一些更改时,我取得了一些进展,但最终还是没有成功。
首先,我注释掉了应用插件行。
接下来,我切换:
classpath "com.thoughtworks.tools:dependency-check:0.0.7"
到:
compile "com.thoughtworks.tools:dependency-check:0.0.7"
在这两个更改之后,它开始识别路径,我可以看到它从存储库中获取项目。
即使路径正确,我仍然遇到应用插件行的问题,每当我将其放入脚本甚至尝试更改“。”时,它都会抛出相同的错误。将其放入“-”中(两者都在说明和不同的存储库示例中使用)。
对此问题的任何帮助将不胜感激!谢谢
最后是 build.gradle 脚本。我不想把这个blob留在帖子的中心。
defaultTasks 'assemble'
// For third party libs that are widely used, keep versions in one place
ext {
MONGO_JAVA_DRIVER = "org.mongodb:mongo-java-driver:2.12.3"
RABBITMQ_VERSION = "com.rabbitmq:amqp-client:3.4.3"
LOG4J = "log4j:log4j:1.2.16"
// For groovy there are multiple libs, just capture version number and use lib-name-$GROOVY_VERSION
GROOVY_VERSION = "2.3.6"
}
//
// Common settings for all projects
//
subprojects {
defaultTasks 'assemble'
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'codenarc'
apply plugin: 'dependency.check'
targetCompatibility = "1.6"
sourceCompatibility = "1.6"
repositories {
mavenCentral()
}
dependencies {
compile LOG4J
compile "org.codehaus.groovy:groovy:${GROOVY_VERSION}"
compile "org.codehaus.groovy:groovy-json:${GROOVY_VERSION}"
compile "org.codehaus.groovy:groovy-templates:${GROOVY_VERSION}"
compile "com.thoughtworks.tools:dependency-check:0.0.7"
testCompile group: 'junit', name: 'junit', version: '4.+'
testCompile "org.codehaus.groovy:groovy-test:${GROOVY_VERSION}"
testCompile "org.hamcrest:hamcrest-core:1.3"
}
clean.doLast {
// The archive path is configured via the jar tasks. Can't use
// delete jar.archivePath because that will configure the delete with
// the wrong (default) path of build/libs/<component.jar>
jar.archivePath.delete()
jarSources.archivePath.delete()
}
//--------------------------------------------------------------------
// Run and test
//--------------------------------------------------------------------
test {
// Uncomment to see standard output when running tests
testLogging.showStandardStreams = true
// This causes tests to run even when nothing has changed
outputs.upToDateWhen { false }
maxParallelForks = 1
}
task runClass(dependsOn: 'classes', type: JavaExec) {
if (project.hasProperty('classToRun')) {
if (project.hasProperty('arguments')) {
args(arguments.split(','))
}
classpath = sourceSets.main.runtimeClasspath
main=classToRun
}
}
//run this task to create source jars
task jarSources(type:Jar){
destinationDir = new File(projectDir.parent + "/sourcelibs")
from sourceSets.main.allSource
classifier 'sources'
}
}