为什么Gradle执行任务" buildEnvironment"而不是" build"当我在Jenkins中添加Artifactory插件并开始构建时?

时间:2016-11-09 16:24:07

标签: jenkins gradle plugins artifactory build-environment

然后执行任务buildEnvironment和artifactoryPublish(期望build和artifactoryPublish)。如果我构建了Jenkins Web UI,它就会这样做。但是,如果我通过控制台构建它,它将执行构建。请帮忙!

控制台输出:

>Started by user admin
>Building in workspace /var/jenkins_home/workspace/example
> > git rev-parse --is-inside-work-tree # timeout=10
>Fetching changes from the remote Git repository
> > git config remote.origin.url https://github.com/topschnitt/final-example/ # timeout=10
>Fetching upstream changes from https://github.com/topschnitt/final-example/
> > git --version # timeout=10
>using GIT_ASKPASS to set credentials 
> > git fetch --tags --progress https://github.com/topschnitt/final-example/
+refs/heads/*:refs/remotes/origin/*
> > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
>Checking out Revision 0488517bd496448390db31589766c0294e64517b (refs/remotes/origin/master)
> > git config core.sparsecheckout # timeout=10
> > git checkout -f 0488517bd496448390db31589766c0294e64517b
> > git rev-list 0488517bd496448390db31589766c0294e64517b # timeout=10
>Jenkins Artifactory Plugin version: 2.7.2
>[Gradle] - Launching build.
>[example] $ /var/jenkins_home/tools/hudson.plugins.gradle.GradleInstallation/gradle_3.2-rc-2/bin/gradle build artifactoryPublish
>Starting a Gradle Daemon (subsequent builds will be faster)
>[buildinfo] Properties file found at '/tmp/buildInfo648703244519681685.properties'
>:buildEnvironment

>------------------------------------------------------------
>Root project
>------------------------------------------------------------

>classpath
>\--- org.jfrog.buildinfo:build-info-extractor-gradle:4+ -> 4.4.7
>     +--- org.apache.ivy:ivy:2.2.0
>     +--- commons-logging:commons-logging:1.1.1
>     +--- commons-io:commons-io:2.2
>     +--- org.codehaus.groovy:groovy-all:2.4.7
>     +--- commons-lang:commons-lang:2.4
>     \--- org.jfrog.buildinfo:build-info-extractor:2.6.3
>          +--- commons-logging:commons-logging:1.1.1
>          +--- commons-io:commons-io:2.2
>          +--- org.jfrog.buildinfo:build-info-client:2.6.3
>          |    +--- commons-codec:commons-codec:1.8
>          |    +--- commons-logging:commons-logging:1.1.1
>          |    +--- commons-io:commons-io:2.2
>          |    +--- org.apache.httpcomponents:httpcore:4.2.5
>          |    +--- org.jfrog.buildinfo:build-info-api:2.6.3
>          |    |    +--- commons-logging:commons-logging:1.1.1
>          |    |    +--- commons-io:commons-io:2.2
>          |    |    +--- com.fasterxml.jackson.core:jackson-databind:2.8.1
>          |    |    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.8.0
>          |    |    |    \--- com.fasterxml.jackson.core:jackson-core:2.8.1
>          |    |    +--- commons-lang:commons-lang:2.4
>          |    |    +--- com.google.guava:guava:18.0
>          |    |    +--- com.thoughtworks.xstream:xstream:1.3.1
>          |    |    |    \--- xpp3:xpp3_min:1.1.4c
>          |    |    \--- com.fasterxml.jackson.core:jackson-core:2.8.1
>          |    +--- org.apache.httpcomponents:httpclient:4.2.5
>          |    |    +--- org.apache.httpcomponents:httpcore:4.2.4 -> 4.2.5
>          |    |    +--- commons-logging:commons-logging:1.1.1
>          |    |    \--- commons-codec:commons-codec:1.6 -> 1.8
>          |    +--- commons-lang:commons-lang:2.4
>          |    +--- com.google.guava:guava:18.0
>          |    +--- com.thoughtworks.xstream:xstream:1.3.1 (*)
>          |    \--- com.fasterxml.jackson.core:jackson-core:2.8.1
>          +--- commons-lang:commons-lang:2.4
>          +--- com.google.guava:guava:18.0
>          \--- com.thoughtworks.xstream:xstream:1.3.1 (*)

>(*) - dependencies omitted (listed previously)
>:artifactoryPublish
>Deploying build descriptor to: http://172.17.0.3:8081/artifactory/api/build
>Build successfully deployed. Browse it in Artifactory under http://172.17.0.3:8081/artifactory/webapp/builds/example/33

>BUILD SUCCESSFUL

>Total time: 4.684 secs
>Build step 'Invoke Gradle script' changed build result to SUCCESS
>[example] $ /bin/sh -xe /tmp/hudson3025876890407099450.sh
>+ cd build/test-results/test/
>+ touch TEST-MyTest.xml
>Archiving artifacts
>Recording test results
>An attempt to send an e-mail to empty list of recipients, ignored.
>Finished: SUCCESS

gradle.build文件:

      buildscript {
repositories {
    maven {
        url 'http://localhost:8081/artifactory/plugins-release'
        credentials {
            username = "${artifactory_user}"
            password = "${artifactory_password}"
        }
    }

}

}  

plugins {  // id "com.jfrog.artifactory" version "4.4.0" }

apply plugin: 'java' apply plugin: 'war'


dependencies{       compile 'org.jmockit:jmockit:1.8+'
    compile 'org.slf4j:slf4j-api:1.7.21+'
    testCompile 'junit:junit:4.12+'
    }

artifactory {
contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not  overridden by the publisher/resolver
publish {
    repository {
        repoKey = 'libs-release-local'
        username = "${artifactory_user}"
        password = "${artifactory_password}"
        maven = true

    }
}
resolve {
    repository {
        repoKey = 'libs-release'
        username = "${artifactory_user}"
        password = "${artifactory_password}"
        maven = true

    }
} }

1 个答案:

答案 0 :(得分:1)

如果您将com.dorongold.task-tree插件添加到构建中,则可以运行

gradle build taskTree

这将显示任务依赖关系树,以便您可以看到正在发生的事情