There are may ways to upload artifacts into Nexus 3 without running a build. (See this article for Nexus 2)
Direct Upload using HTTP POST to Components REST API
A generic component upload REST API is available as of version 3.9.0.
Nexus 3.9.0 to 3.13.0 - POST /service/rest/beta/components
Nexus 3.13.0 and newer - POST /service/rest/v1/components
Information and examples at our help site.
Direct Upload using HTTP PUT to the Repository Path
Some repository formats such as Maven 2, YUM, and RAW allow direct upload of assets using HTTP PUT. Formats such as NuGet, NPM, and Docker DO NOT support these type of simple HTTP PUT uploads.
You can do an HTTP PUT of local file to a repository path using the form /repository/<repo-id>/<path-of-file>.
A curl example:
curl -v -u admin:admin123 --upload-file pom.xml http://localhost:8081/repository/maven-releases/org/foo/1.0/foo-1.0.pom
- admin is the user name and admin123 is the password
- pom.xml is the local file being uploaded
- Nexus 3 UI is running at http://localhost:8081/
- the file is being uploaded into a repository with id maven-releases
- upon success, the uploaded file will downloadable from http://localhost:8081/repository/maven-releases/org/foo/1.0/foo-1.0.pom
Use a Format Specific Client
Each repository format has specific client side tools that are used to interact with a repository. Your first choice when uploading files to a repository manager is use an official client by consulting their documentation.
Example Client Tools that can deploy files by Repository Format - we do not claim this list to be exhaustive:
Maven 2 maven-deploy-plugin:deploy-file Goal
You can deploy files using the "deploy-file" goal on the Maven deploy plugin.
Example without a pom file:
mvn deploy:deploy-file -DgroupId=com.somecompany -DartifactId=project -Dversion=1.0.0 -DgeneratePom=true -Dpackaging=jar -DrepositoryId=nexus -Durl=http://localhost:8081/repository/maven-releases -Dfile=target/project-1.0.0.jar
With a pom file:
mvn deploy:deploy-file -DgeneratePom=false -DrepositoryId=nexus -Durl=http://localhost:8081/repository/maven-releases -DpomFile=pom.xml -Dfile=target/project-1.0.0.jar
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=http://localhost:8081/repository/maven-snapshots -Dfile=target/project-1.0.0-SNAPSHOT.jar
Note: The "repositoryId" property value is not a Nexus repository ID. it is the <id> element value of a <server> section in your settings.xml file which has the credentials needed for deployment. If these credentials are not configured you will see an error like: "Return code is: 401, ReasonPhrase: Unauthorized."
Maven 2 wagon-maven-plugin:upload-single Goal
You can deploy files using the "upload-single" goal on the Maven Wagon plugin. This approach is useful when deploying adhoc files to a "raw" repository.
mvn wagon:upload-single -Dwagon.serverId=nexus -Dwagon.url=http://localhost:8081/repository/raw-hosted/ -Dwagon.fromFile=fileToUpload.txt
Note: The "wagon.serverId" property value is not a Nexus repository ID. It is the <id> element value of a <server> section in your settings.xml file which has the credentials needed for deployment. If these credentials are not configured you will see an error like: "Return code is: 401, ReasonPhrase: Unauthorized."