http://carvin.iteye.com/blog/785365
First, software preparation
1, apache-maven-3.0-bin.tar.gz:http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0-bin.tar.gz
2, nexus-oss-webapp-1.8.0-bundle.tar.gz:http://nexus.sonatype.org/downloads/
Second, MAVEN installation configuration
1. Create user groups and users who need to operate MAVEN (if not created with root installation)
Java code
- #groupadd Configer //create user groups
- #useradd-G Configer configer //create user and specify user group
- #passwd Configer //assigning passwords to users
2. Create an extract directory and extract the apache-maven-3.0-bin.tar.gz file to the specified directory
Java code
- #cd/opt
- #mkdir maven
- #chown-R Configer:configer/opt/maven
- #chmod 755/opt/maven
- #su-L Configer
- #tar-zvxf apache-maven-3.0-bin.tar.gz
2. Configure Environment variables
Java code
- #vi/home/configer/.bash_profile
Add the following line to the file:
Java code
- m2_home=/opt/maven/apache-maven-3.0
- Export M2_home
- Path= $PATH: $M 2_home/bin
- Export PATH
3. View version
Java code
- #cd/opt/maven/apache-maven-3.0/bin
- #mvn--version
If version information is displayed, it should be created under the ${user} directory. M2 directory
4. View. M2 Directory
Java code
- #cd/home/configer/.m2
- If you do not have a. M2 directory, you can manually add a
- #mkdir. m2
5. If you need to assign the MAVEN repository directory to a different directory, modify the configuration file Settings.xml file in conf under the MAVEN installation directory
Java code
- #vi/opt/maven/apache-maven-3.0/conf/settings.xml
- Open the <localRepository>....</localRepository> comment in the file
- Or add in the file added under this comment
- <localrepository>your Repository path</localrepository>
Ii. Building a Nexus
1. Unzip the nexus-oss-webapp-1.8.0-bundle.tar.gz file to the specified directory
Java code
- #tar-zvxf nexus-oss-webapp-1.8. 0-bundle.tar.gz
2. Start Nexus
Java code
- #cd/opt/maven/nexus-oss-webapp-1.8. 0/BIN/JSW
- Select the version of your machine:
- #cd linux-x86-32/
- #./nexus start
- Restart:
- #./nexus restart
- Stop it:
- #./nexus stop
3. Run Nexus
In the browser, type: Http://localhost:8081/nexus
You can see the Nexus's homepage, click on the upper right corner of the log in
The default user name and password are: admin/admin123
After running, a Nexus working directory will be generated automatically sonatype-work,nexus the downloaded jar package will be stored in
In Sonatype-work/nexus/storage
4. Configuration
1) Click on the left menu repositories
In the list on the right, respectively,
Java code
- Apache Snapshots
- Codehaus Snapshots
- Maven Central
The download Remote Index configuration of three repository is changed to true, and the settings are saved.
Then right click on the list of three repository, click Reindex
2) Add new repository, some of the more common jar packages may not be found in the nexus provided by the repository,
Generally more commonly used are
Java code
- Two of JBoss:
- http://repository.jboss.org/maven2/
- http://repository.jboss.org/nexus/content/repositories/releases/
- Sun's:
- http://download.java.net/maven/2/
- K-int's:
- http://developer.k-int.com/maven2/
- Because looking for Juel:juel-impl:2.2. 1 This jar package, so I also added a look for myself:
- http://repository.exoplatform.org/content/groups/public/
To add a step:
Java code
- Click Add->proxy repository-> to fill in the Repository ID, Repository Name, and other defaults for remote Storage location.
3) Add the new repository to the public repositories
In the configuration of public repositories, add all the items in the multiple-selection select to the left, and then save.
4) Add your own jar package
Java code
- In the repository list there is a 3rd party, that is, a third side jar package, click to see a Artifact Upload tab, click, fill in the appropriate information.
- GAV Definition General Choice GAV Parameters
- Then add Group:Artifact:Version:Package
- Example Juel:juel-impl:2.2. 1:jar
Then select the jar package to upload and save
5) Set up proxy server in Nexus
Select the server option in the left Administrator menu, and in the lower middle of the page that opens on the right, there is a selection: Default HTTP proxy Settings (optional) selects the check box and fills in the appropriate proxy server information.
6) Write your own settings.xml, the file content is as follows:
Java code
- <settings>
- <proxies>
- <proxy>
- <id>normal</id>
- <active>true</active>
- <protocol>http</protocol>
- <username>deployment</username>
- <password>deploy</password>
- 8081/nexus
- <port>80</port>
- <nonproxyhosts>localhost:8081/nexus</nonproxyhosts>
- </proxy>
- </proxies>
- <mirrors>
- <mirror>
- <!--this was used to direct the public snapshots Repo in the
- Profile Below a different Nexus group--
- <id>nexus-public-snapshots</id>
- <mirrorOf>public-snapshots</mirrorof>
- <url>http://localhost:8081/nexus/content/groups/public-snapshots</url>
- </mirror>
- <mirror>
- <!--this sends everything else
- <id>nexus</id>
- <mirrorOf>*</mirrorOf>
- <url>http://localhost:8081/nexus/content/groups/public</url>
- </mirror>
- </mirrors>
- <profiles>
- <profile>
- <id>development</id>
- <repositories>
- <repository>
- <id>central</id>
- <url>http://central</url>
- <releases><enabled>true</enabled></releases>
- <snapshots><enabled>true</enabled></snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>central</id>
- <url>http://central</url>
- <releases><enabled>true</enabled></releases>
- <snapshots><enabled>true</enabled></snapshots>
- </pluginRepository>
- </pluginRepositories>
- </profile>
- <profile>
- <!--This profile would allow snapshots to beingsearched when activated-->
- <id>public-snapshots</id>
- <repositories>
- <repository>
- <id>public-snapshots</id>
- <url>http://public-snapshots</url>
- <releases><enabled>false</enabled></releases>
- <snapshots><enabled>true</enabled></snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- Font-size:1em; M
Linux installation configuration maven3.0 and setting up a Nexus