Gradle, Exclude an Artifact When Uploading to Artifactory - jenkins

I have a Gradle build that runs in Jenkins and Deploys to Artifactory using the Artifactory plugin for Jenkins. I am uploading a tar.gz file to Artifactory. The plugin is uploading the tar.gz correctly, but it is also uploading a jar.
How can I exclude the jar so that it is not deployed to Artifactory?
build.gradle (artifacts section)
artifacts {
archives tar
}

If you don't need a jar, maybe you shouldn't use the 'java' plugin?
Take a look at various base plugins, one of them might be a better match.

Related

Is there any way to get Jenkins artifacts in Gitlab pipeline?

Basically the opposite of this question: Is there any way to get Gitlab pipeline artifacts in Jenkins?
My project is built on Jenkins. It generates a JavaDoc.
I want to publish this JavaDoc as a Gitlab Pages.
So I would need my gitlab-yml to be able to retrieve the produced javadoc from Jenkins.
Alternatively, my artifacts are stored on a network drive, so an access to this network drive would work too
I think that this plugin could be helpful to you...
There is a plugin called Archived Artifact Url Viewer. It seems to be like you needs.
"Jenkins plugin to view contents of a file inside a zip or jar file under a subdirectory of artifacts directory of a build The url to access a file inside a zip or jar archive within the artifact folder of a build is as follows"
/archivedArtifacts/artifact/<job_name>/<build_number/<relative location of zip or jarfile within artifact folder>/<location of file within archive>
Ex:
http://<jenkins_url>/archivedArtifacts/artifact/Build%20-%20Dev/10526/junit-logs.zip/junit.log
https://plugins.jenkins.io/archived-artifact-url-viewer/

Uploading nexus artifacts using apache ant

I am using apache ant to build artifacts. Finally, all artifacts will be zipped in one zip file. Jenkins plugin 'Nexus Artifact Uploader' will upload this zip file to nexus repository(version 3.x). However, there are frequent incidents where Jenkins machine/admin were unavailable.
I am able to download nexus artifacts using ant get task. I want to upload artifacts using apache ant.
Please Note: I am not supposed to use maven or curl/wget commands. I am expected to achieve it using apache ant only.

.m2 is not getting updated with latest xmlbeans jar files

I do have a jenkins job that builds XML beans jar files from the internal gitlab project and puts it on the artifactory. While having a build, this XML beans jar files are downloaded to the .m2 maven local repository. However, if this jar file exists in the .m2 repository then maven does not bother to download it from the artifactory. With being said, if there is a gitlab change, it does build it and put it on the artifactory. As there is already a jar file exist in .m2 repository, an old jar file is not being replaced with the new one. We ended up a wrong dependency to the customer with a release.
The question is , What am I doing wrong here?
mvn clean install -U
-U means maven will force update snapshot dependencies. Release dependencies can't not be updated this way.

POM not released using Jenkins and Artifactory Release

We're trying to use the Artifactory release process in Jenkins to publish a jar file created by a Gradle build into a Maven repo in our Artifactory server.
It nearly all works, the only issue is that the pom file isn't being copied into the Artifactory repo.
The Gradle build includes the Gradle Maven plugin and running gradlew install locally results in both the jar and the pom inserted into the local Maven repo.
I've added a task in the Gradle build that generates the pom file in the same directory as the jar file and changed the Jenkins build to run that task too.
When the build has completed I can see both the jar and the pom file in the workspace.
Any ideas on what I need to do to get the pom file published along with the jar?
We're using:
Jenkins 2.10
Artifactory plugin 2.4.4
Gradle 2.14
The Gradle build file does not inlcude the Gradle Artifactory plugin.
Cheers, Andy
The Jenkins project is configured to use the Gradle-Artifactory integration (rather than the Generic-Artifactory integration).
As suggested by Dakota Brown I'm answering my own question, the solution to my problem was to un-tick the maven3 integration option. With that option unslected, everything works as expected.

Downloading Nexus artifacts to Jenkins Job workspace

I have an use case where I need to download selected jar files from nexus repository to a Jenkins job workspace and run a program over the downloaded jar files. (I Want to use the .class files in the jars)
Is there any Jenkins plugin available for this?
Add a build-step in the job, prior to the one doing the actual work
and use a copy (or ftp) command to get the files.
You could try the groovy plugin and embed a script within your Jenkins job

Resources