I am newly learning Jenkins CI tool. I have issue while deploying artifacts from Jenkins to nexus. Here i attached screen shot Jenkins error snap with my pom file and maven setting file configuration.
Pom.xml
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://localhost:8080/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
maven/setting.xml
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
Could please some one help me on this issue ? Many thanks.
Your using the artifactory plugin to upload to nexus, artifactory is a different repository manager.
Also your url to nexus is wrong, should be something like http://localhost:8080/nexus/content/repositories/dev_repo
Also if you've already configured your maven to upload to a repo, then just run mvn publish.
Related
I would like to set up a Maven repository with Artifactory.
What are the steps to setup Maven plugins repo in Artifactory. I have to load Maven Jacoco plugin from Artifactory local repo.
Seems your use case can be achieved with general instructions of Maven Repository of Artifactory. Since, you would like to deploy maven type package/plugins, there would no difference in the setup.
We should be able resolve the deployed packages/plugins from maven clients without any issues. Is there anything difference in the use case?
I have a Jfrog Artifactory installation which has some artifacts. I want to pull these artifacts onto my Jenkins .m2 repository. I don't have much knowledge of Jenkins.
As long as you have properly configured you maven remote repository settings, maven will resolve the artifacts and place them in the local repo during the build process.
Alternatively, (not recommended), you can use curl or wget and mvn install:install-file -Dfile=<path-to-file> ... , but that is rather pointless and more work than letting maven do what maven does.
Cloudbees has recommendations for settings if you don't want them in you repo's settings.xml; S/O answer has some advice, as does the pipeline-maven plugin and the Jenkins Docs.
I have a project structure like this:
- parent-project : pom.xml
+ child-project: pom.xml
+ child-project-2: pom.xml
I would like to upload the artifact of child-project to Nexus, so in pom.xml file of my child-project, I defined:
<distributionManagement>
<repository>
<id>nexus</id>
<url>http://my-repo:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<url>http://my-repo:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
And when I run the child-project with mvn clean deploy from eclipse, the jar file of child-project is uploaded to my-repo nexus repository as expected.
In Jenkins I have an job which is configured with the parent-project pom.xml. Now I would like to publish the artifact of my child-project to nexus after jenkins finished the build process. What I have done so far is:
Downloaded and installed the Nexus Platform Plugin in Jenkins
Configured the Nexus Repository Manager Servers with the credential to my Nexus 3.x Server in Jenkins System Configuration
In the Post-Build tab, I added a new Nexus Repository Manager Publisher with the Info about my nexus repository but now getting stuck at the Maven Artifact session as below:
What make me confused here are:
what should I put in the Maven Artifact session? I tried child-project/target/child-project-0.0.1-SNAPSHOT.jar but it did not work. Jenkins threw an exception
java.io.IOException:
child-project/target/child-project-0.0.1-SNAPSHOT.jar does not exist
Why do I need to specify the version of the artifact here? Does it mean that every time I change the version of my child-project, then I have to come here and modify the version?
If I already defined in pom.xml of my child-project the session with Info about the Nexus repo, why do I need to define it here again?
Is it possible that I configure the job build directly with mvn clean deploy like I did in eclipse to push the artifact to nexus? If yes then I dont need the Nexus Repository Manager Publisher anymore? And how can I configure the authentication for the nexus server like what I have in setting.xml in my /.m2 folder?
Can anyone help me to clarify the points above? Thank you very much!
you don't need the plugin
you can run maven clean install deploy from shell in your job
I'm using pipeline syntax so it's actual code but you can use jenkins ui
to create a shell step
How can I use maven in an 'undeploy' fashion to remove an artefact deployed to the nexus staging repo?
I currently execute the a command like below for deployment:
deploy:deploy-file -Durl=${bamboo.ArtefactsNexusUrl} -DrepositoryId=${bamboo.nexusRepoId} -DgroupId=${bamboo.GroupId} -DartifactId=${bamboo.ArtefactName} -Dversion=${bamboo.inject.VERSION} -Dfile=${bamboo.ArtefactName}-${bamboo.inject.VERSION}.${bamboo.ArtefactExtension} -Dpackaging=${bamboo.ArtefactExtension}
You can drop the whole staging repository with the Nexus Staging Maven Plugin or via the Nexus user interface. Check out the documentation in the book.
I have a non maven project whose binaries get deployed to Nexus.
I used gradle's maven plugin to create the artifacts and publish it to Nexus
Now, the trouble is how do I promote this artifacts to release in Nexus? I tried looking up the M2 release plugin for jenkins but it looks for the pom file in my source code.
There are a number of Gradle examples including usage with the Nexus staging suite in the Nexus book examples and eval guide.