Open sebasira opened 4 years ago
I can confirm that this only happens to Android Libraries (that produces .aar artifacts). I've tested with 3 different modules and all of them behave the same way. Two of them had not changed since the last successful deploy and when trying to upload a dummy verison (with only changing the version and nothing else, just to test the deployment) they were not deployed.
Also test a Java library and was successfully deployed to the same Artifactory server with the same GitLab CI/CD script.
Taking a closer look into the logs I've posted, I've notice that JFrog Gradle plugin (for Build Info extraction and Artifactory publishing) has also change and has been updated 3 days ago.
When artifacts are not deployed (maybe I should say generated, becuase I think they are not even generated and that why they are not deployed)
[Info] gradle build config successfully created.
[Info] Downloading bintray/jcenter/org/jfrog/buildinfo/build-info-extractor-gradle/4.18.0/build-info-extractor-gradle-4.18.0-uber.jar
[Info] Downloaded 1 artifact.
[Info] Running gradle command: ./gradlew --init-script /root/.jfrog/dependencies/gradle/4.18.0/gradle.init clean artifactoryPublish -b build.gradle
And when it was working:
Info] gradle build config successfully created.
[Info] Downloading bintray/jcenter/org/jfrog/buildinfo/build-info-extractor-gradle/4.15.2/build-info-extractor-gradle-4.15.2-uber.jar
[Info] Downloaded 1 artifact.
[Info] Running gradle command: ./gradlew --init-script /root/.jfrog/dependencies/gradle/4.15.2/gradle.init clean artifactoryPublish -b build.gradle
Thanks for reporting this issue, @sebasira You diagnostic is correct. We did update the Gradle extractor version in the latest JFrog CLI release. Apologize for this issue. The last Gradle plugin releases includes many bug fixes and new features and we think it should be in the latest JFrog CLI. As a workaround you can use JFrog CLI 1.39.7 for now.
To speed up the fix, I created https://github.com/jfrog/build-info/pull/407. However in order to make sure all cases have been covered, we would appreciate additional information from you:
build.gradle
file, do you apply explicitly the Gradle Artifactory plugin? (apply plugin: 'com.jfrog.artifactory'
)build.gradle
? Do you specify the publications you wish to publish , for example:
publishing {
publications {
app(MavenPublication) {
groupId = group
artifactId = project.getName()
version = currentVersion
artifact("$buildDir/outputs/apk/release/app-release-unsigned.apk")
}
}
}
Thanks in advance.
@yahavi thank you for looking into this and for publishing a PR.
I'l answer your questions with the same number.
1- No. I 'm actually not using the Artifactory Gradle Plugin in my build.gradle
. I relay in the jFrog CLI and GitLab CI/CD Pipeline to deploy. The jFrog CLI command uses the artifactory gradle. This is part of the YAML script from the first post where I use jFrog CLI
./jfrog rt gradle-config --use-wrapper=true --repo-resolve=$GRADLE_REPO_KEY --server-id-resolve=Default-Server --repo-deploy=$GRADLE_REPO_KEY --server-id-deploy=Default-Server
./jfrog rt gradle clean artifactoryPublish -b build.gradle --build-name=$ARTIFACT_NAME --build-number=$CI_JOB_ID
My build.gradle
file knows nothing about the Artifactory Gradle Plugin. Here it's a simplify version of it:
apply plugin: 'com.android.library'
// This is what ArtifactoyyPublish task (in GitLab CI/CD Pipeline) uses to determine the PATH and VERSION of the uploaded artifact
group = 'ar.com.sebasira'
version = '6.3.7'
project.archivesBaseName = rootProject.name
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 29
targetSdkVersion 29
versionName project.version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
externalNativeBuild {
cmake {
cppFlags "-frtti -fexceptions"
}
}
}
buildTypes {
debug {
minifyEnabled false
}
release {
minifyEnabled false
consumerProguardFiles 'proguard-my-lib-rules.pro'
}
}
libraryVariants.all { variant ->
variant.outputs.all {
outputFileName = "${rootProject.name}-${defaultConfig.versionName}.aar"
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
}
repositories {
maven {
url '<my-artifactory-repo>'
}
}
dependencies {
// All dependencies goes here
}
2- I think the answer to this question is also in the above answer. Look at this part of my build-gradle
libraryVariants.all { variant ->
variant.outputs.all {
outputFileName = "${rootProject.name}-${defaultConfig.versionName}.aar"
}
}
I also have in settings.gradle
include ':app'
rootProject.name='my-cool-library'
With this info (and the versions from the first lines of the build.gradle
file) it will generate an artifact with this name:
my-cool-library-6.3.7.aar
And this line from the build.gradle
file was very important for the naming (I don't remember exavtly why, but I got issues without it):
project.archivesBaseName = rootProject.name
And this is my full GitLab CI/CD YAML script (with only the deploy stage):
image: jangrewe/gitlab-ci-android
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .gradle/
variables:
GRADLE_VERSION: "6.7"
ARTIFACT_NAME: "my-cool-library"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
stages:
- deploy
.connect_artifactory: &connect_artifactory |
curl -fL https://getcli.jfrog.io | sh
./jfrog rt config --url=$ARTIFACTORY_URL --user=$ARTIFACTORY_USER --password=$ARTIFACTORY_PASS
./jfrog rt c show
.upload_artifact: &upload_artifact |
./jfrog rt gradle-config --use-wrapper=true --repo-resolve=$GRADLE_REPO_KEY --server-id-resolve=Default-Server --repo-deploy=$GRADLE_REPO_KEY --server-id-deploy=Default-Server
./jfrog rt gradle clean artifactoryPublish -b build.gradle --build-name=$ARTIFACT_NAME --build-number=$CI_JOB_ID
.install_gradle: &install_gradle |
curl -L https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-all.zip -o gradle.zip
unzip -q gradle.zip
export GRADLE_HOME=$(pwd)/gradle-$GRADLE_VERSION
export PATH=${GRADLE_HOME}/bin:${PATH}
echo $GRADLE_HOME
echo $PATH
gradle -v
publish:
stage: deploy
cache: {}
script:
# Download and Install Gradle
- *install_gradle
# Connect to JFrog Artifactory
- *connect_artifactory
# Replace the repository name in the configuration.yml to the correct one.
- sed -i 's,GRADLE_REPO_KEY,'"$GRADLE_REPO_KEY"',g' configuration.yaml
# Upload artifact to JFrog Artifactory
- *upload_artifact
Notice that there is a variable name $ARTIFACT_NAME
that MUST have the same name that my rootProject.name
3- About the minimal example, I would love to. The only problem is that my setup is very tight to my private GitLab Server and also a private Artifactory Server. I can create a dummy Android Library but I would need a public GitLab repo to post it wher eI can configure the CI/CD to deploy to a public Artifactory Server.
And finally, you said:
As a workaround you can use JFrog CLI 1.39.7 for now.
How can achieve that? I've try this:
curl -fL https://getcli.jfrog.io | sh -s v1.39.7
but it will give me this output:
[32;1m$ curl -fL https://getcli.jfrog.io | sh -s v1.39.7 # collapsed multi-line command[0;m
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 178 100 178 0 0 552 0 --:--:-- --:--:-- --:--:-- 552
100 1344 100 1344 0 0 3622 0 --:--:-- --:--:-- --:--:-- 3622
Downloading version v1.39.7 of JFrog CLI...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 85 100 85 0 0 129 0 --:--:-- --:--:-- --:--:-- 128
./jfrog: line 1: {message:Could not find artifact with path 'v1.39.7/jfrog-cli-linux-amd64/jfrog'}: No such file or directory
section_end:1604010794:build_script
[0Ksection_start:1604010794:after_script
[0Ksection_end:1604010795:after_script
[0Ksection_start:1604010795:upload_artifacts_on_failure
[0Ksection_end:1604010797:upload_artifacts_on_failure
[0K[31;1mERROR: Job failed: exit code 1
[0;m
This is the relevant part:
./jfrog: line 1: {message:Could not find artifact with path 'v1.39.7/jfrog-cli-linux-amd64/jfrog'}: No such file or directory
I also try with all other versions, even in my local computer and have the same error when I run the curl command in the terminal. It seems like there are no binaries for older versions just the latest one
@sebasira You can find all available CLI versions in Bintray: https://bintray.com/jfrog/jfrog-cli-go. For example, here is the link for Linux amd64: https://bintray.com/jfrog/jfrog-cli-go/download_file?file_path=1.39.7%2Fjfrog-cli-linux-amd64%2Fjfrog
Thank you! I can now deploy library updates with the older version of the jFrog CLI. I'll put the workaround here in case anyone stumble upon this:
In my previous GitLab CI/CD YAML script need to make the change in the .connect_artifactory sub-script. Replace:
curl -fL https://getcli.jfrog.io | sh
with this:
curl -L https://bintray.com/jfrog/jfrog-cli-go/download_file?file_path=1.39.7%2Fjfrog-cli-linux-amd64%2Fjfrog --output jfrog
chmod +x jfrog
Notice that the URL points to the linux-amd64 distribution, change that url according to your OS.
I'll keep waiting for the official fix. Thank you!
@sebasira after a deeper look at your curl command, I managed to download version 1.39.7 of the CLI with the getCli:
curl -fL https://getcli.jfrog.io | sh -s 1.39.7
I just removed the v
before the version.
By the way - using the getCli is the preferred way since it automatically detects the operating system and it is more resilient to changes.
We will seriously investigate and will search for "out of the box" solution for Android users. We will also keep you updated here.
Thank you very much!
I also think the best way is using getCLI
script. I'll update my scripts.
If I can be of any assistance to test for Android libraries, it would be my pleasure.
About the Android sample project to reproduce this, I was thinking that the GitLab repo is not needed. I can create a sample Android project, with a bash script (emulating the YAML script of GitLab) and it should be working in the same way. You would only need to change some variables to point to your Artifactory server URL with your credentials.
Thanks, @sebasira
A minimal sample Android project would be appreciated. Most interesting are the build.gradle
file and the information on what do you expects to be uploaded by default (apk? aar?).
If you want to contribute code, you can upload the sample here: https://github.com/jfrog/project-examples/tree/master/gradle-examples as gradle-android-example-ci-server
by creating a pull request. Otherwise, a simple GitHub repository will do.
Hi!
It's been a long time... I've created a sample library so that you guys can work with it and I submit it as a PR.
I'd like to remark that the extension of the artifact is .aar, and you can find in the build.gradle
file how I rename the artifact to the name I want. I'm guessing the extension is the issue.
I'm here again with this issue because I was using a previous version of jFrog CLI but now I can no longer use it because it seems that it uses an old artifact that's no longer available:
[Info] gradle build config successfully created.
[Info] Downloading bintray/jcenter/org/jfrog/buildinfo/build-info-extractor-gradle/4.15.2/build-info-extractor-gradle-4.15.2-uber.jar
[Error] 403 Forbidden
ERROR: Job failed: exit code 1
For what is worth, I have more information after adding INFO logging level to the script:
> Task :app:assembleRelease
Skipping task ':app:assembleRelease' as it has no actions.
:app:assembleRelease (Thread[Daemon worker,5,main]) completed. Took 0.001 secs.
:app:artifactoryPublish (Thread[Daemon worker,5,main]) started.
> Task :app:artifactoryPublish
Caching disabled for task ':app:artifactoryPublish' because:
Build cache is disabled
Task ':app:artifactoryPublish' is not up-to-date because:
Task has not declared any outputs despite executing actions.
:app:artifactoryPublish (Thread[Daemon worker,5,main]) completed. Took 0.003 secs.
:artifactoryPublish (Thread[Daemon worker,5,main]) started.
> Task :artifactoryPublish
Caching disabled for task ':artifactoryPublish' because:
Build cache is disabled
Task ':artifactoryPublish' is not up-to-date because:
Task has not declared any outputs despite executing actions.
:artifactoryPublish (Thread[Daemon worker,5,main]) completed. Took 0.003 secs.
:extractModuleInfo (Thread[Daemon worker,5,main]) started.
> Task :extractModuleInfo
Caching disabled for task ':extractModuleInfo' because:
Build cache is disabled
Task ':extractModuleInfo' is not up-to-date because:
Task.upToDateWhen is false.
:extractModuleInfo (Thread[Daemon worker,5,main]) completed. Took 0.546 secs.
:app:extractModuleInfo (Thread[Daemon worker,5,main]) started.
> Task :app:extractModuleInfo
Caching disabled for task ':app:extractModuleInfo' because:
Build cache is disabled
Task ':app:extractModuleInfo' is not up-to-date because:
Task.upToDateWhen is false.
Artifacts for configuration 'androidTestAnnotationProcessor' were not all resolved, skipping
Artifacts for configuration 'androidTestApi' were not all resolved, skipping
Artifacts for configuration 'androidTestCompile' were not all resolved, skipping
Artifacts for configuration 'androidTestCompileOnly' were not all resolved, skipping
Artifacts for configuration 'androidTestDebugAnnotationProcessor' were not all resolved, skipping
Artifacts for configuration 'androidTestDebugApi' were not all resolved, skipping
Artifacts for configuration 'androidTestDebugCompile' were not all resolved, skipping
Artifacts for configuration 'androidTestDebugCompileOnly' were not all resolved, skipping
Artifacts for configuration 'androidTestDebugImplementation' were not all resolved, skipping
Artifacts for configuration 'androidTestDebugProvided' were not all resolved, skipping
Artifacts for configuration 'androidTestDebugPublish' were not all resolved, skipping
Artifacts for configuration 'androidTestDebugRuntimeOnly' were not all resolved, skipping
Artifacts for configuration 'androidTestDebugWearApp' were not all resolved, skipping
Artifacts for configuration 'androidTestImplementation' were not all resolved, skipping
Artifacts for configuration 'androidTestProvided' were not all resolved, skipping
Artifacts for configuration 'androidTestPublish' were not all resolved, skipping
Artifacts for configuration 'androidTestReleaseAnnotationProcessor' were not all resolved, skipping
Artifacts for configuration 'androidTestReleaseApi' were not all resolved, skipping
Artifacts for configuration 'androidTestReleaseCompile' were not all resolved, skipping
Artifacts for configuration 'androidTestReleaseCompileOnly' were not all resolved, skipping
Artifacts for configuration 'androidTestReleaseImplementation' were not all resolved, skipping
Artifacts for configuration 'androidTestReleaseProvided' were not all resolved, skipping
Artifacts for configuration 'androidTestReleasePublish' were not all resolved, skipping
Artifacts for configuration 'androidTestReleaseRuntimeOnly' were not all resolved, skipping
Artifacts for configuration 'androidTestReleaseWearApp' were not all resolved, skipping
Artifacts for configuration 'androidTestRuntimeOnly' were not all resolved, skipping
Artifacts for configuration 'androidTestUtil' were not all resolved, skipping
Artifacts for configuration 'androidTestWearApp' were not all resolved, skipping
Artifacts for configuration 'annotationProcessor' were not all resolved, skipping
Artifacts for configuration 'api' were not all resolved, skipping
Artifacts for configuration 'archives' were not all resolved, skipping
Artifacts for configuration 'compile' were not all resolved, skipping
Artifacts for configuration 'compileOnly' were not all resolved, skipping
Artifacts for configuration 'coreLibraryDesugaring' were not all resolved, skipping
Artifacts for configuration 'debugAllApiPublication' were not all resolved, skipping
Artifacts for configuration 'debugAllRuntimePublication' were not all resolved, skipping
Artifacts for configuration 'debugAndroidTestAnnotationProcessorClasspath' were not all resolved, skipping
Artifacts for configuration 'debugAndroidTestCompileClasspath' were not all resolved, skipping
Artifacts for configuration 'debugAndroidTestRuntimeClasspath' were not all resolved, skipping
Artifacts for configuration 'debugAnnotationProcessor' were not all resolved, skipping
Artifacts for configuration 'debugAnnotationProcessorClasspath' were not all resolved, skipping
Artifacts for configuration 'debugApi' were not all resolved, skipping
Artifacts for configuration 'debugApiElements' were not all resolved, skipping
Artifacts for configuration 'debugApiPublication' were not all resolved, skipping
Artifacts for configuration 'debugCompile' were not all resolved, skipping
Artifacts for configuration 'debugCompileClasspath' were not all resolved, skipping
Artifacts for configuration 'debugCompileOnly' were not all resolved, skipping
Artifacts for configuration 'debugImplementation' were not all resolved, skipping
Artifacts for configuration 'debugProvided' were not all resolved, skipping
Artifacts for configuration 'debugPublish' were not all resolved, skipping
Artifacts for configuration 'debugRuntimeClasspath' were not all resolved, skipping
Artifacts for configuration 'debugRuntimeElements' were not all resolved, skipping
Artifacts for configuration 'debugRuntimeOnly' were not all resolved, skipping
Artifacts for configuration 'debugRuntimePublication' were not all resolved, skipping
Artifacts for configuration 'debugUnitTestAnnotationProcessorClasspath' were not all resolved, skipping
Artifacts for configuration 'debugUnitTestCompileClasspath' were not all resolved, skipping
Artifacts for configuration 'debugUnitTestRuntimeClasspath' were not all resolved, skipping
Artifacts for configuration 'debugWearApp' were not all resolved, skipping
Artifacts for configuration 'default' were not all resolved, skipping
Artifacts for configuration 'implementation' were not all resolved, skipping
Artifacts for configuration 'jacocoAgent' were not all resolved, skipping
Artifacts for configuration 'jacocoAnt' were not all resolved, skipping
Artifacts for configuration 'lintChecks' were not all resolved, skipping
Artifacts for configuration 'provided' were not all resolved, skipping
Artifacts for configuration 'publish' were not all resolved, skipping
Artifacts for configuration 'releaseAllApiPublication' were not all resolved, skipping
Artifacts for configuration 'releaseAllRuntimePublication' were not all resolved, skipping
Artifacts for configuration 'releaseAnnotationProcessor' were not all resolved, skipping
Artifacts for configuration 'releaseApi' were not all resolved, skipping
Artifacts for configuration 'releaseApiElements' were not all resolved, skipping
Artifacts for configuration 'releaseApiPublication' were not all resolved, skipping
Artifacts for configuration 'releaseCompile' were not all resolved, skipping
Artifacts for configuration 'releaseCompileOnly' were not all resolved, skipping
Artifacts for configuration 'releaseImplementation' were not all resolved, skipping
Artifacts for configuration 'releaseProvided' were not all resolved, skipping
Artifacts for configuration 'releasePublish' were not all resolved, skipping
Artifacts for configuration 'releaseRuntimeElements' were not all resolved, skipping
Artifacts for configuration 'releaseRuntimeOnly' were not all resolved, skipping
Artifacts for configuration 'releaseRuntimePublication' were not all resolved, skipping
Artifacts for configuration 'releaseUnitTestAnnotationProcessorClasspath' were not all resolved, skipping
Artifacts for configuration 'releaseUnitTestCompileClasspath' were not all resolved, skipping
Artifacts for configuration 'releaseUnitTestRuntimeClasspath' were not all resolved, skipping
Artifacts for configuration 'releaseWearApp' were not all resolved, skipping
Artifacts for configuration 'runtimeOnly' were not all resolved, skipping
Artifacts for configuration 'testAnnotationProcessor' were not all resolved, skipping
Artifacts for configuration 'testApi' were not all resolved, skipping
Artifacts for configuration 'testCompile' were not all resolved, skipping
Artifacts for configuration 'testCompileOnly' were not all resolved, skipping
Artifacts for configuration 'testDebugAnnotationProcessor' were not all resolved, skipping
Artifacts for configuration 'testDebugApi' were not all resolved, skipping
Artifacts for configuration 'testDebugCompile' were not all resolved, skipping
Artifacts for configuration 'testDebugCompileOnly' were not all resolved, skipping
Artifacts for configuration 'testDebugImplementation' were not all resolved, skipping
Artifacts for configuration 'testDebugProvided' were not all resolved, skipping
Artifacts for configuration 'testDebugPublish' were not all resolved, skipping
Artifacts for configuration 'testDebugRuntimeOnly' were not all resolved, skipping
Artifacts for configuration 'testDebugWearApp' were not all resolved, skipping
Artifacts for configuration 'testImplementation' were not all resolved, skipping
Artifacts for configuration 'testProvided' were not all resolved, skipping
Artifacts for configuration 'testPublish' were not all resolved, skipping
Artifacts for configuration 'testReleaseAnnotationProcessor' were not all resolved, skipping
Artifacts for configuration 'testReleaseApi' were not all resolved, skipping
Artifacts for configuration 'testReleaseCompile' were not all resolved, skipping
Artifacts for configuration 'testReleaseCompileOnly' were not all resolved, skipping
Artifacts for configuration 'testReleaseImplementation' were not all resolved, skipping
Artifacts for configuration 'testReleaseProvided' were not all resolved, skipping
Artifacts for configuration 'testReleasePublish' were not all resolved, skipping
Artifacts for configuration 'testReleaseRuntimeOnly' were not all resolved, skipping
Artifacts for configuration 'testReleaseWearApp' were not all resolved, skipping
Artifacts for configuration 'testRuntimeOnly' were not all resolved, skipping
Artifacts for configuration 'testWearApp' were not all resolved, skipping
Artifacts for configuration 'wearApp' were not all resolved, skipping
:app:extractModuleInfo (Thread[Daemon worker,5,main]) completed. Took 2.012 secs.
:artifactoryDeploy (Thread[Daemon worker,5,main]) started.
> Task :artifactoryDeploy
Caching disabled for task ':artifactoryDeploy' because:
Build cache is disabled
Task ':artifactoryDeploy' is not up-to-date because:
Task has not declared any outputs despite executing actions.
:artifactoryDeploy (Thread[Daemon worker,5,main]) completed. Took 0.211 secs.
AAPT2 aapt2-4.2.1-7147631-linux Daemon #0: shutdown
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 4m 13s
35 actionable tasks: 33 executed, 2 up-to-date
Job succeeded
@sebasira, Thanks for the reproducer! We will look into it and hopefully will fix this issue soon.
@sebasira,
The JFrog CLI uses the maven-publish
plugin to collect the publications in order to upload them to Artifactory.
I followed this guide to configure publications on Android: https://developer.android.com/studio/build/maven-publish-plugin
To make the reproducer work, you should define the requested publications.
I manage to publish test-library-name-1.1s.aar
using the following steps:
maven-publish
plugin at the top of the file.afterEvaluate
clause:
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
// Applies the component for the release build variant.
from components.release
artifactId = "${rootProject.name}"
version = "${android.defaultConfig.versionName}"
}
}
}
// Add the new "release" publication to the list of publications to publish:
artifactoryPublish {
publications(publishing.publications.release)
}
}
applicationId "com.example.testlibrary"
. I'm not sure why but I got the following exception: Library projects cannot set applicationId
.Results:
➜ gradle-android-library-example-ci-server git:(master) ✗ jfrog rt gradle clean aP [Info] Running gradle command: ./gradlew --init-script /Users/yahavi/.jfrog/dependencies/gradle/4.24.12/gradle.init clean aP [pool-9-thread-1] Deploying artifact: http://127.0.0.1:8081/artifactory/libs-release-local/test-library-name/test-library-name/1.1s/test-library-name-1.1s.aar [pool-9-thread-1] Deploying artifact: http://127.0.0.1:8081/artifactory/libs-release-local/test-library-name/test-library-name/1.1s/test-library-name-1.1s.module
Please let me know if that helped.
Thank you!
Yes this resolves the issue! You can close it if you like. I did not do it just in case you need or what additional information
About the applicationId
that was my bad! It's correct libraries can not set the applicationId
. Only applications can set the applicationId
I'm sorry... I have a new issue right now with this setup.
The problem is that I've got 2 stages on my CI configuration: test and deploy.
To speed up trial-and-error tests I was making, I've remove the test stage. And when I re-add it I've got an error in the test stage saying that:
Could not find method artifactoryPublish() for arguments [build_65alhtgfhtvsukhk0xe6ip8kl$_run_closure2$_closure18@48b7f5f3] on project ':app' of type org.gradle.api.Project.
I'm guessing that's because in my original configuration I was not using the Artifactory Gradle Plugin and making the deployment via CI/CD. And in the test stage I do not have anything related to Artifactory.
Is there any way to solve this issue from the CI script and not using the gradle plugin?
I mean, the proposed changes are relaying on changes at the build.gradle
file. I would like not to do so and just relay on the CI config file.
Till now I've been using jFrog CLI v1.39.7 and it's still working fine with the current configuration. So if it was (and still is) possible without the Gradle Plugin, I was hoping in keeping it that way.
Could it be possible to apply the same instructions/configuration provided in the afterEvaluate
via the CLI?
I've also realize I was missing the gitlab-ci.yml
file in the submitted PR. I'm sorry about that! I'll add it right now!
To be more clear... if I understand correctly, if put the deployment in the build.gradle
after each build the artifacts will be deployed. Even when in my local machine, I guess, right?
I only want to upload the artifacts in the CI Server (GitLab) if tests passes and everything is correct. So I would like not to have anything related to Artifactory in the build.gradle
file. I'm using the same setup to deploy .jar
(other Java libraries) and it works without a problem. But since version 1.40.0 the .aar
files stop being deployed. It's like they are not found because they have another extension...
@sebasira, First, just to make sure that we are aligned, The JFrog CLI uses the Gradle Artifactory plugin to resolve dependencies and publish artifacts to Artifactory.
I think I can make it worked like in 1.39.7, but please note that this method is deprecated from the Gradle side, and may break in the future. Until this version, we used the old Gradle publish-configurations method, e.g. we extract the archives collected by the default archive
configuration. You can read more about this method here.
Therefore we recommend you to define publications as instructed in the official Android guide: https://developer.android.com/studio/build/maven-publish-plugin
You can make it work using one of the 3 options:
Always run Gradle with the JFrog CLI:
jfrog rt gradle clean aP
jfrog rt gradle clean test
Always apply the Artifactory plugin: Add this at the top of your build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release"
}
}
apply plugin: 'com.jfrog.artifactory'
Also, run `jfrog rt gradle-config ...` with `--uses-plugin` flag.
3. Optionally run the artifactoryPublish by wrapping it with `pluginManager.withPlugin('com.jfrog.artifactory')`:
```groovy
pluginManager.withPlugin('com.jfrog.artifactory') {
artifactoryPublish {
publications(publishing.publications.release)
}
}
Please let me know if that helped.
@yahavi thank you again!
Please excuse me, after re-reading my latest comment it was really a mess... That's because my head is a mess and sometimes I do not find the right words to express my self. I will try to make it as clear as I can.
Yes, I know jFrog CLI uses the Artifactory Gradle plugin. What I would like to avoid is to have any artifactory configuration in the build.gradle
file. I would like that anything related to that will be present in the gitlab-ci.yml
file. As it is today. Maybe with .aar
files that's not possible and that's the whole center of the discussion.
If I'm following the conversation right, that's not possible and the afterEvaluate block is recommended/mandatory for .aar
files. Am I right?
I don't have knowledge on groovy so I understand only a little about your suggestions. I think the one I like the most is the 3rd. Because what I understand is that it will only call the artifactoryPublish if the artifactory plugin is present, and that condition will only be met when at the deploy stage. Is that correct? I've try it and now all stages passes and artifacts are deployed.
@sebasira, Your input helps us to learn and to keep improving. Thanks again!
You are right. Currently, there is no option to publish Android variants without publication and the Artifactory configuration in the build.gradle
file. However, that doesn't mean that in the future there wouldn't be such options. The goal is to make these kinds of builds as simple as possible.
I'm glad to hear that the 3rd option worked for you.
it will only call the artifactoryPublish if the artifactory plugin is present, and that condition will only be met when at the deploy stage. Is that correct?
That's correct.
Please let us know if there are any more difficulties.
It's a pleasure!
Thank all of you for this tool that allows me to work and keep my dependencies available from a central repo!
If you ever need any help regarding Android in the future, I'll be glad to help.
Feel free to close this issue... I didn't what to do it my self because I believe you should take that decision.
Describe the bug I've been using for a long time a GitLab CI/CD script to upload artifacts to Artifactory. Suddenly, the artifacts were not deployed, with no errors or warning. I came here to check and I notice you've created a new release 3days ago. And the last time a deploy succeed was indeed 3days ago.
To Reproduce Here's part of the GitLab YAML script I'm using:
Expected behavior The artifact should be uploaded/deplyed to Artifactory
Screenshots Instead of screenshot I can provide logs from GitLab CI/CD Job. One think I've notice is that when the deployment was working the logs were much bigger, it seems like some gradle task were not executing
Log when the deployment work:
And when it's not deployed:
Versions
Additional context You will notice it uses Gradle v5.6.4. I've also update it to Gradle v6.7 with the same result, and the went back to v5.6.4 because was the last that suceed.
One thing I've notice from the below logs is that the jfrog-cli download size is different and that's what lead me to think that this happens on the latest version.
I try to set a previous version when downloading but it gives me another error:
Maybe I'm just miss-using the cli with this new version, if that's the case, can you guide me?
Thanks in advance!