我試圖從以下鏈接使用dependency.check,並且在按照給出的指示進行操作時,無法讓它正常運行(完全)。應用Gradle依賴關係檢查插件
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'的插件。
我做一些改變的時候取得了一點進步,但仍最終未果。
首先,我註釋了apply插件行。
接下來,我切換:
到:
compile "com.thoughtworks.tools:dependency-check:0.0.7"
它開始認識到路徑這兩個變化後,我能看到它從抓項目存儲庫。
即使路徑正確,我仍然遇到apply插件行的問題,它會在我將其放入腳本時拋出相同的錯誤,甚至嘗試更改'。'。在它裏面放入一個' - '(兩個都用於說明和不同的存儲庫示例中)。
對這個問題的任何幫助,將不勝感激!謝謝
最後這裏是build.gradle腳本。我不想把這個蠢貨留在帖子的中心。
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'
}
}
您必須添加插件depenencies根項目的buildscript –