![]() This REST api worked for me for uploading a release artifact in a release repository. There is an external guide which describes how to upload artifacts using Powershell. curl -upload-file my.zip -u admin:admin123 -v Note that the user performing this deploy must have the "Unpack" privilege in Nexus, as well as create privileges in the target repository.Īlso note that the files in the zip must be in the standard repository layout of the target repository. curl -upload-file my.zip -u admin:admin123 -v If the zipped file has a directory structure example of "project/.", then you want to deploy to the "com/company" level of repository. ![]() If the zipped file has a directory structure of "com/company/project/.", then you want to deploy to the root level of repository. So for example, using curl: curl -upload-file my.zip -u admin:admin123 -v The files will be unpacked and deployed individually on the server side, just as if they had been individually deployed from a client using standard deploy mechanisms. Required: Ensure that there is no trailing slash in the URL used): /service/local/repositories//content-compressed/path/you/want/them/to/appear/in Once enabled, you can use a REST endpoint to upload zip files via PUT request. Download the bundle.zip which matches your nexus version, and unpack it in $NEXUS_HOME/nexus/WEB-INF/plugin-repository. In Nexus OSS you need to manually install the plugin. You can enable this plugin in earlier versions of Nexus Professional by moving "$NEXUS_HOME/nexus/WEB-INF/optional-plugins/nexus-unpack-plugin-" into "$NEXUS_HOME/nexus/WEB-INF/plugin-repository" and restarting the server. ![]() In Nexus Professional 2.6.x and earlier, the optional plugin needs to be installed. In Nexus Professional 2.7.x+, the plugin is already installed by default. Uploading Multiple Artifacts at Once Using Unpack Plugin Enable the Nexus Unpack Plugin Note: Uploading via the REST API requires that the user has the "artifact upload" privilege in Nexus, in addition to create and update privileges on the target repository. If you are uploading a pom, then the parameters g, a, v, p, and c are not needed as part of the command as those values are extracted from the pom.mlĬ - classifier (optional, not shown in examples above)įile - each file to be uploaded, use one file parameter per file. HasPom - whether you are supplying the pom or you want one generated. If you are uploading a pom file, then the pom file parameter must come before the rest of the file parameters, but after all the other parameters.įor reference, here are all the available form parameters for this endpoint: This requires a multi-part form POST to /service/local/artifact/maven/content.ġ) Uploading an artifact and generating a pom file: curl -v -F r=releases -F hasPom=false -F e=jar -F g=com.test -F a=project -F v=1.0 -F p=jar -F -u admin:admin123 2) Uploading an artifact with a pom file: curl -v -F r=releases -F hasPom=true -F e=jar -F -F -u admin:admin123 3) Uploading a pom file by itself (with no artifact): curl -v -F r=releases -F hasPom=true -F -u admin:admin123 Important : The file parameters MUST COME LAST or the curl commands will not work. Note: The "repositoryId" parameter is not a Nexus repository ID, it is the ID of a server section in your settings.xml file which has then credentials needed for deployment. This plugin goal also allows deployment of snapshot versions, and the plugin will take care of calculating the timestamped version needed: mvn deploy:deploy-file -DgroupId=com.somecompany -DartifactId=project -Dversion=1.0.0-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -DrepositoryId=nexus -Durl= -Dfile=target/project-1.0.0-SNAPSHOT.jar With a pom file: mvn deploy:deploy-file -DgeneratePom=false -DrepositoryId=nexus -Durl= -DpomFile=pom.xml -Dfile=target/project-1.0.0.jar You can deploy files using the "deploy-file" goal on the Maven deploy plugin.Įxample without a pom file: mvn deploy:deploy-file -DgroupId=com.somecompany -DartifactId=project -Dversion=1.0.0 -DgeneratePom=true -Dpackaging=jar -DrepositoryId=nexus -Durl= -Dfile=target/project-1.0.0.jar Using curl you can do this with: curl -v -u admin:admin123 -upload-file pom.xml Maven "deploy-file" Deployment You can do an HTTP PUT of a file into /content/repositories//. (See this article for Nexus Repo 3) Direct Deploy There are several ways to upload artifacts into Nexus Repo 2 without running a build.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |