To configure a Maven project to publish artifacts to Nexus, you'll need to add a distributionManagement element to your project's pom.xml. Here's an example of a distributionManagement element that contains the appropriate configuration to deploy snapshots and releases to a server running on your.server.com port 8081:
If your Nexus server requires authentication, you will also need to place your credentials in ~/.m2/settings.xml in a servers element. Here's a sample servers element using the default username and password for the deployment user:
Once you've configured your project's pom.xml and your Maven Settings, you can deploy your project with "mvn deploy" which will execute the build up to the deploy phase. When you run a deploy with a project that has a snapshot version, Maven will deploy to the repository defined in snapshotRepository, and when you run a build with a project that has a release version it will deploy to the repository defined in the repository element.