I got this output from Jenkins console while trying to compile an android project: just notice that I didn\'t make any change on the main Class this is the jenkins console:
The Archive Artifacts post-build step does not care about your POM. All it does is look for files in your workspace folder, i.e $WORKSPACE
(also accessible through http://[jenkins-url]/job/[job-name]/ws
) and archives those within Jenkin's build history.
The files that you are trying to archive must exist in the $WORKSPACE
. From your configuration, you are trying to archive **/target/*.apk
which means "under any path, folder target
with any file and extension .apk
". It can't find that, since your workspace doesn't have folder target
anywhere, hence the ERROR: ‘**/target/*.apk’ doesn’t match anything: ‘**’ exists but not ‘**/target/*.apk’
In your POM file, you have the following line:
<directory>${project.basedir}/assets/build</directory>
This is what identifies where your built files end up. It is [base-dir-of-pom]/assets/build
, not target
.
Also, form your console log:
[JENKINS] Archiving /var/opt/jenkins/workspace/Android-Project-App/trunk/assets/build/project-android.apk
Which further proves that your .apk
artifact is in fact located under trunk/assets/build
For your Archive Artifacts file pattern, you need to use:
**/assets/build/*.apk
And as a matter of fact, you could use just:
**/build/*.apk
or even
**/*.apk
But the question is: do you really want to be archiving the artifacts on Jenkins (which takes space) when you are already archiving the artifacts with Maven?
I wanted to archive release.apk, and I ran into the same trouble as you. Jenkins prompts me should do like: app/build/outputs/apk/yourAppName/release/*.apk, and it fixed my problem.