build-info
build-info copied to clipboard
(Critical) Bug in Gradle Artifactory Plugin 4.5+
Hi Guys, We are using the Gradle Artifactory Plugin (https://plugins.gradle.org/plugin/com.jfrog.artifactory) and it seems there is a very annoying bug in the version 4.5.0 and 4.5.1.
If we use the version 4.4.18, everything works fine but as soon as we use the version 4.5+ artifactory is no longer able to go from a build to an artifact (it shows "No path found (externally resolved or deleted/overwritten)" ), but it is still able to show the build numbers in the artifact page.
I am able to repro the issue 100% of the time so I can provide additional informations if you need
Can you have a look on that issue ?
@mvives-broadsign, We are not seeing this issue when using the gradle-examples. Can you try running these examples? Also, can you please share with us a sample project which reproduces this issue?
Hi Guys I've set up a small repo for test case here: https://github.com/mvives-broadsign/ci-238-issue-gradle-artifactory
You need to edit https://github.com/mvives-broadsign/ci-238-issue-gradle-artifactory/blob/master/tools/3rdparty_builder/3rdParty/build.gradle to put an artifactory repo with good credentials (I am using a standard gradle type repo with default layout (even with custom layout the issue is reproducible))
then from the folder tools/3rdparty_builder/3rdParty/, you can execute ./gradlew artifactoryPublish
When I have 4.5+ on line 30, the issue happens, if I put 4.4.18, it works
Let me know if something is missing in the repo.
@mvives-broadsign, We are trying to reproduce the issue using your example, we changed the Artifactory credentials in build.gradle but we couldn't see the issue, using both 4.5.1 and 4.4.18 versions. When we built the project we couldn't see any dependencies downloaded from Artifactory, maybe there are more configuration to modify in the build script?
Hi Everyone,
I also encountered this issue, while trying to integrate the newest version of the plugin (4.5.4) into my build. It seems to me the problem is related to manipulating the clientConfig.info
object. When I manually set the buildNumber
, the artifact references are no longer available.
As a workaround I also went back to 4.4.18, where it works correctly.
Furthermore the gradle-examples repository does not contain an example, when the info object is manipulated (or I failed to notice), while the one provided by mvives-broadsign has (could be the same problem).
@nemeth-z and @mvives-broadsign, We managed to identify and fix this issue. We've just pushed this commit with the fix. GAP-283 tracks the release of this fix. We created a snapshot version which includes the fix. We'd appreciate your feedback for it. Here's how you install the snapshot version in your gradle script:
buildscript {
repositories {
maven {
url "https://oss.jfrog.org/oss-snapshot-local"
}
jcenter()
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.5.x-SNAPSHOT')
}
}
}
We're looking forward to your feedback.
@eyalbe4 I tried to verify the new version, however with my current setup, artifacts are no longer published at all (artifacts are missing from the build-info.json, Deploy task do not upload any). Here is a configuration snippet I currently use (using Gradle 4.0):
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'
artifactory {
contextUrl = '<internal-artifactory-url>'
resolve {
repository {
repoKey = '<internal-repo1>'
}
}
publish {
repository {
repoKey = '<internal-repo2>'
}
defaults {
publications ('pluginMaven')
}
}
clientConfig.info.with {
buildName = rootProject.name
buildNumber = 'trial01'
}
}
// each subproject uses the java-gradle-plugin which sets up the publications
gradle.beforeProject { Project project ->
project.with {
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'
artifactoryPublish.dependsOn tasks.withType(GenerateMavenPom), assemble
}
}
I had no time to experiment too much yet, was there any change on how to configure publication sources?
@nemeth-z, I can see that the new implementation does not upload artifacts with Gradle 4 (I tried Gradle 4.3.1). It does however run as expected with Gradle 3. I'm investigating this now...
OK @nemeth-z, I think I figured it out. It looks like gradle 4+ (I tested it with gradle 4.3.1) skips tasks which have no method with the @TaskAction annotation. So I pushed this commit which seems to resolve the issue. Try running your build again now. It should fetch the latest Artifactory Plugin's snapshot with the fix automatically. Please let us know if it works.
@eyalbe4
Tried the newest snapshot, no difference: artifacts are not deployed. I also upgraded to Gradle 4.3.1, to make sure it is not the culprit.
I also noticed the artifactoryPublish
no longer creates the build-info.json
file, or not even called when artifactoryDeploy is executed (but I guess this is related to other changes).
It seems publications are not scanned at all, as even after a clean (removing poms and jars), deploy task is executing successfully.
@nemeth-z, I tried running the gradle-example-publish, which uses publications, with gradle 4.3.1. I modified its buildscript as follows, so that it uses the latest snapshot as follows:
buildscript {
repositories {
maven {
url "https://oss.jfrog.org/oss-snapshot-local"
}
jcenter()
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.5.x-SNAPSHOT')
}
configurations.classpath {
resolutionStrategy {
cacheDynamicVersionsFor 0, 'seconds'
cacheChangingModulesFor 0, 'seconds'
}
}
}
The got the following build output:
$ gradle clean artifactoryP
Download https://oss.jfrog.org/oss-snapshot-local/org/jfrog/buildinfo/build-info-extractor-gradle/4.5.x-SNAPSHOT/build-info-extractor-gradle-4.5.x-20171116.164158-10.pom
Download https://oss.jfrog.org/oss-snapshot-local/org/jfrog/buildinfo/build-info-extractor/2.9.x-SNAPSHOT/build-info-extractor-2.9.x-20171114.173249-2.pom
Download https://oss.jfrog.org/oss-snapshot-local/org/jfrog/buildinfo/build-info-client/2.9.x-SNAPSHOT/build-info-client-2.9.x-20171114.173249-2.pom
Download https://oss.jfrog.org/oss-snapshot-local/org/jfrog/buildinfo/build-info-api/2.9.x-SNAPSHOT/build-info-api-2.9.x-20171114.173249-2.pom
Download https://oss.jfrog.org/oss-snapshot-local/org/jfrog/buildinfo/build-info-extractor/2.9.x-SNAPSHOT/build-info-extractor-2.9.x-20171114.173249-2.jar
Download https://oss.jfrog.org/oss-snapshot-local/org/jfrog/buildinfo/build-info-extractor-gradle/4.5.x-SNAPSHOT/build-info-extractor-gradle-4.5.x-20171116.164158-10.jar
Download https://oss.jfrog.org/oss-snapshot-local/org/jfrog/buildinfo/build-info-api/2.9.x-SNAPSHOT/build-info-api-2.9.x-20171114.173249-2.jar
Download https://oss.jfrog.org/oss-snapshot-local/org/jfrog/buildinfo/build-info-client/2.9.x-SNAPSHOT/build-info-client-2.9.x-20171114.173249-2.jar
> Task :artifactoryDeploy
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/1.0-SNAPSHOT/api-1.0-SNAPSHOT.ja
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/1.0-SNAPSHOT/api-1.0-SNAPSHOT.properties
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/1.0-SNAPSHOT/api-1.0-SNAPSHOT.tx
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/ivy-1.0-SNAPSHOT.xml
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/1.0-SNAPSHOT/api-1.0-SNAPSHOT.pom
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/shared/1.0-SNAPSHOT/shared-1.0-SNAPSHOT.jar
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/shared/1.0-SNAPSHOT/shared-1.0-SNAPSHOT.properties
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/shared/1.0-SNAPSHOT/shared-1.0-SNAPSHOT.pom
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/webservice/1.0-SNAPSHOT/webservice-1.0-SNAPSHOT.jar
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/webservice/1.0-SNAPSHOT/webservice-1.0-SNAPSHOT.properties
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/webservice/1.0-SNAPSHOT/webservice-1.0-SNAPSHOT.pom
Deploying build descriptor to: http://localhost:8081/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under http://localhost:8081/artifactory/webapp/builds/gradle-example-publish/1511093089025
Notice all the build-info dependencies which the build downloads from oss-snapshot-local. In case they are not downloaded, then it means that they are cached under the ~/.gradle/ directory or in the maven local repository (~/.m2/repository/) and should be removed. To further troubleshoot this issue, can you also try and run the same example?
Sadly I had no time to further experiment with the snapshot, and I have to put my focus on different tasks. I will most probably won't have time working on the upgrade this year any more.
This is still an issue with 4.7.0 and 4.7.1. Any attempt to set the BuildNumber after initial configuration results in the artifact paths not showing up in the build info. Using Gradle 4.6.1 it is not possible to downgrade back to 4.6.x so I have no workarounds.
EDIT: Workaround:
clientConfig.info.setBuildNumber('9.9.9.9)
clientConfig.properties['allRootConfig']['artifactory.deploy.build.number'] = '9.9.9.9'
I see a similar issue on artifactory jenkins plugin: https://issues.jenkins-ci.org/browse/JENKINS-52363
@eyalbe4 hi , i have same issue when i will change the ver to 4.5+ and + it will not work i will see in my build "No path found (externally resolved or deleted/overwritten" classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.4.18
any news ?
Noam
@Noam-greenberrg, I think this issue discusses more than one scenarios, so it is a bit hard to follow. Are you trying to set a custom build name or build number in your gradle script?
@eyalbe4
yes to "custom build name or build number" i am doing this two
clientConfig.info.setBuildNumber(version)
and in the gradle settings.gradle i am using
rootProject.name = " some_name "
@Noam-greenberrg,
I tried replicating this issue as follows. Can you please try the following as well? I tried to put here everything, including the outputs I received. To make things easy to compare, please try and use the same sample project I used. Hopefully this will revel the root cause of the issue.
Run the gradle-example-publish project according to the instructions in the README. Your build output should be:
Download https://jcenter.bintray.com/org/jfrog/buildinfo/build-info-extractor-gradle/maven-metadata.xml
> Task :artifactoryDeploy
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/1.0-SNAPSHOT/api-1.0-SNAPSHOT.jar
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/1.0-SNAPSHOT/api-1.0-SNAPSHOT.properties
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/1.0-SNAPSHOT/api-1.0-SNAPSHOT.txt
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/ivy-1.0-SNAPSHOT.xml
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/1.0-SNAPSHOT/api-1.0-SNAPSHOT.pom
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/shared/1.0-SNAPSHOT/shared-1.0-SNAPSHOT.jar
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/shared/1.0-SNAPSHOT/shared-1.0-SNAPSHOT.properties
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/shared/1.0-SNAPSHOT/shared-1.0-SNAPSHOT.pom
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/webservice/1.0-SNAPSHOT/webservice-1.0-SNAPSHOT.jar
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/webservice/1.0-SNAPSHOT/webservice-1.0-SNAPSHOT.properties
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/webservice/1.0-SNAPSHOT/webservice-1.0-SNAPSHOT.pom
Deploying build descriptor to: http://localhost:8081/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under http://localhost:8081/artifactory/webapp/builds/gradle-example-publish/1532275098050
Now let's add the add the following two lines to the artifactory closure in the build.gradle file:
clientConfig.info.setBuildName('new-strange-name')
clientConfig.info.setBuildNumber('' + new java.util.Random(System.currentTimeMillis()).nextInt(20000))
After adding these lines, your artifactory closure should look as follows:
artifactory {
clientConfig.setIncludeEnvVars(true)
clientConfig.info.addEnvironmentProperty('test.adding.dynVar',new java.util.Date().toString())
contextUrl = 'http://localhost:8081/artifactory'
publish {
repository {
repoKey = 'libs-snapshot-local' // The Artifactory repository key to publish to
username = "${artifactory_user}" // The publisher user name
password = "${artifactory_password}" // The publisher password
// This is an optional section for configuring Ivy publication (when publishIvy = true).
ivy {
ivyLayout = '[organization]/[module]/ivy-[revision].xml'
artifactLayout = '[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]'
mavenCompatible = true //Convert any dots in an [organization] layout value to path separators, similar to Maven's groupId-to-path conversion. True if not specified
}
}
defaults {
// Reference to Gradle publications defined in the build script.
// This is how we tell the Artifactory Plugin which artifacts should be
// published to Artifactory.
publications('mavenJava')
publishArtifacts = true
// Properties to be attached to the published artifacts.
properties = ['qa.level': 'basic', 'dev.team' : 'core']
publishPom = true // Publish generated POM files to Artifactory (true by default)
publishIvy = true // Publish generated Ivy descriptor files to Artifactory (true by default)
}
}
clientConfig.info.setBuildName('new-strange-name')
clientConfig.info.setBuildNumber('' + new java.util.Random(System.currentTimeMillis()).nextInt(20000))
}
Now run then build again. You should get the following output:
Download https://jcenter.bintray.com/org/jfrog/buildinfo/build-info-extractor-gradle/maven-metadata.xml
> Task :artifactoryDeploy
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/1.0-SNAPSHOT/api-1.0-SNAPSHOT.jar
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/1.0-SNAPSHOT/api-1.0-SNAPSHOT.properties
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/1.0-SNAPSHOT/api-1.0-SNAPSHOT.txt
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/ivy-1.0-SNAPSHOT.xml
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/api/1.0-SNAPSHOT/api-1.0-SNAPSHOT.pom
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/shared/1.0-SNAPSHOT/shared-1.0-SNAPSHOT.jar
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/shared/1.0-SNAPSHOT/shared-1.0-SNAPSHOT.properties
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/shared/1.0-SNAPSHOT/shared-1.0-SNAPSHOT.pom
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/webservice/1.0-SNAPSHOT/webservice-1.0-SNAPSHOT.jar
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/webservice/1.0-SNAPSHOT/webservice-1.0-SNAPSHOT.properties
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/gradle/publish/webservice/1.0-SNAPSHOT/webservice-1.0-SNAPSHOT.pom
Deploying build descriptor to: http://localhost:8081/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under http://localhost:8081/artifactory/webapp/builds/new-strange-name/4099
Notice the configured custom build name and build number in the URL at the bottom line of the output: http://localhost:8081/artifactory/webapp/builds/new-strange-name/4099 If you browse to this URL and drill down into one of the modules, you'll see the list of artifacts along with their paths in Artifactory. I took the following screenshot.
@Noam-greenberrg, Did you get a chance to try this out? This issue seems to be open for a long time and we'd like to know if this issue is still relevant for anyone with the latest releases of the Gradle Artifactory Plugin. Thanks
I was troubleshooting a similar issue maven and jenkins today where the artifacts were deploying, they had links to the build, but the build had "No path found (externally resolved or deleted/overwritten)" and promotion from staging to release would fail. Turns out permissions on the staging repo were setup without "Annotate" and adding this permission fixed my issue.
I was encountering the same issue with the gradle-example project. Here is the stacktrace:
mbp /tmp/project-examples/gradle-examples/gradle-example (master)$ ./gradlew clean build
git branch: master
Parallel execution is an incubating feature.
FAILURE: Build failed with an exception.
* Where:
Build file '/private/tmp/project-examples/gradle-examples/gradle-example/build.gradle' line: 27
* What went wrong:
A problem occurred evaluating root project 'gradle-example'.
> Failed to apply plugin [id 'com.jfrog.artifactory']
> Cannot cast object 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention@30ebc659' with class 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention' to class 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
@nan-yu, your issue is not the same at all. See that topic starter says about No path found
message?
Also, are you trying to build JFrog project-examples? If so, why do you assume that the problem is in the plugin? You should open the issue there.