Maven release project to nexus

Source: Internet
Author: User
Preparation

First, confirm that you have installed nexus, Maven, and SVN.

Configure Maven

Open. m2/setting. xml

The configuration is as follows: <! -- If you have installed nexus, it indicates the release location of your release and snapshots versions, but it is only used as a marker for project pom file ing -->

<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository/> <interactiveMode/> <usePluginRegistry/> <offline/> <pluginGroups/> <servers> <server>         <id>nexus-releases</id>        <username>admin</username>         <password>admin123</password>       </server>       <server>         <id>nexus-snapshots</id>         <username>admin</username>         <password>admin123</password>       </server>    </servers>   <mirrors/> <proxies/> <profiles/> <activeProfiles/> </settings> 

Create a test project

mvn archetype:create   -DgroupId=com.yourcompany  -DartifactId=myproject  -DarchetypeArtifactId=maven-archetype-quickstart

Set up your SVN path. Suppose the path on SVN is as follows:

-trunk    -myproject-branches-tags

Modify the POM File

<Project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion> 4.0.0 </modelversion> <groupid> COM. yourcompany </groupid> <artifactid> myproject4 </artifactid> <! -- Here must be the snapshot version --> <version> 1.0-Snapshot </version> <packaging> jar </packaging> <Name> myproject </Name> <URL> http://maven.apache.org </ URL> <Properties> <project. build. sourceencoding> UTF-8 </project. build. sourceencoding> </Properties> <dependencies> <dependency> <groupid> JUnit </groupid> <artifactid> JUnit </artifactid> <version> 3.8.1 </version> <scope> Test </scope> </dependency> </dependencies> <! -- Configure your project path --> <SCM> <connection> SCM: SVN: http: // Michael-du/SVN/trunk/myproject </connection> <strong connection> SCM: SVN: https: // Michael-du/SVN/trunk/myproject </your connection> </SCM> <! -- Here and start setting. XML, configure the svn upload path --> <distributionmanagement> <repository> <ID> nexus-releases </ID> <Name> nexus release repository </Name> <URL> HTTP: // 10.0.25.8: 8081/nexus/content/repositories/releases </URL> </Repository> <snapshotrepository> <ID> nexus-snapshots </ID> <Name> nexus snapshot repository </Name> <URL> HTTP: // 10.0.25.8: 8081/nexus/content/repositories/snapshots </URL> </snapshotrepository> </Distributionmanagement> <! -- Pack the release version into a tag and upload it to SVN --> <build> <plugins> <plugin> <groupid> org. apache. maven. plugins </groupid> <artifactid> Maven-release-plugin </artifactid> <version> 2.0-beta-9 </version> <configuration> <tagbase> https: // Michael-du/SVN/tags </tagbase> </configuration> </plugin> </plugins> </build> </Project>

MVN release: Prepare Note: A snapshot version will be created and uploaded to the svn tag directory, and your version will change.
MVN deploy personal note: Upload the snapshot version to nexus
MVN release: perform personal note: Upload release to nexus

Others:

  • Release: Clean clean up after a release preparation.
  • Release: Prepare prepare for a release in SCM.
  • Release: Prepare-with-Pom prepare for a release in SCM, and generate
    Release poms that record the fully resolved projects used.
  • Release: rollback a previous release.
  • Release: Perform perform a release from SCM.
  • Release: stage perform a release from SCM into a staging Folder/Repository.
  • Release: branch create a branch of the current project with All Versions
    Updated.
  • Release: Update-versions update the versions in the POM (s ).
Reference; http://maven.apache.org/plugins/maven-release-plugin/index.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.