- Add these tasks to your
build.gradle
. - In your Jenkins build, add a shell task which executes the line
./gradlew copyDependencies
- Add a Invoke Nexus Policy Evaluation, and from the Advanced options add
build/dependencies/**/*
to the scan locations
Last active
October 25, 2019 13:09
-
-
Save HokieGeek/f47083f659c7e7815369e76231aa3a58 to your computer and use it in GitHub Desktop.
Gradle dependencies with Lifecycle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def targetPath = file("$buildDir/dependencies") | |
task verifyTargetPath { | |
doLast { | |
if (!targetPath.exists()) { | |
mkdir targetPath | |
} | |
} | |
} | |
task copyCompileDependencies(type: Copy, dependsOn: ['verifyTargetPath']) { | |
into targetPath | |
from configurations.compile | |
} | |
task copyTestDependencies(type: Copy, dependsOn: ['verifyTargetPath']) { | |
into targetPath | |
from configurations.testCompile | |
} | |
task copyDependencies(dependsOn: ['copyCompileDependencies', 'copyTestDependencies']) { | |
println "Copying dependencies to " + targetPath | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task iqScan(type: JavaExec) { | |
main = '-jar' | |
args "<PATH TO JAR>", | |
'-s', 'http://localhost:8070', | |
'-i', '<APP NAME>', | |
'-a', '<IQ USER>:<IQ PASS>', | |
targetPath | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment