'How to integrate Jenkins and Nexus (without maven)
jenkins and nexus are installed in docker containers on the same machine. All guides describe how to do the integration using the maven. But what if I just need to upload files from Jenkins to Nexus? I know that this can be done through a plugin "Nexus Artifact Uploader", but I don’t understand exactly how
Solution 1:[1]
In Nexus Artifact Uploader
, you need to fill up the following details:
Note: Below are the sample example data and the pre-requisite is to have a repository created in nexus.
- Nexus Version: NEXUS3 (Type of Nexus Repository Manager ex. NEXUS2 or NEXUS3)
- Protocol: HTTP (Protocol used for Nexus setup ex. HTTP or HTTPS)
- Nexus URL: localhost:8081 (URL of Nexus)
- Credentials: nexus-admin (credentials used to access nexus)
- GroupId: portal (unique base name of the company or group that created the project)
- Version: 1.0 (version of the project)
- Repository: maven-releases (name of the repository where you want to upload the artifacts)
- ArtifactId: web-portal (a unique name of the project)
- Type: tar.gz (type of artifact packaging like zip, tar, war, jar etc)
- File: web-portal.tar.gz (File path in the workspace. ex: artifact.zip or artifact.jar)
Find the screenshot as well:
Solution 2:[2]
The most simple way to connect you nexus with Jenkins - and Nexus OSS is using the maven setting.xml Many tutorials are very complicated - the solution is more easy than it seems.
Step 1: create in your nexus an user with with deploy roles
Step 2: create in your Jenkins (Config File Provider Plugin) a setting.xml with the following entry:
<servers>
<server>
<id>local-nexus</id>
<username>mvn-deployer</username>
<password>mvn-deployer</password>
</server>
</servers>
Step 3: enter in your project pom.xml the deployment information:
<distributionManagement>
<snapshotRepository>
<id>local-nexus</id>
<url>http://127.0.0.1:8082/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>local-nexus</id>
<url>http://127.0.0.1:8082/repository/maven-releases/</url>
</repository>
</distributionManagement>
<repositories>
<repository>
<id>local-nexus</id>
<url>http://127.0.0.1:8082/repository/maven-public/</url>
</repository>
</repositories>
Step 4: create a maven jenkins build project
Step 5: as least you just need to run the mvn command deploy.
Don't forget to expose for your docker containers all necessary ports
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sourav |
Solution 2 | Elmar Dott |