Linux installation configuration maven3.0 and setting up a Nexus

Source: Internet
Author: User
Tags gz file jboss maven central sonatype

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
    1. #groupadd Configer //create user groups
    2. #useradd-G Configer configer //create user and specify user group
    3. #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
    1. #cd/opt
    2. #mkdir maven
    3. #chown-R Configer:configer/opt/maven
    4. #chmod 755/opt/maven
    5. #su-L Configer
    6. #tar-zvxf apache-maven-3.0-bin.tar.gz



2. Configure Environment variables

Java code
    1. #vi/home/configer/.bash_profile


Add the following line to the file:

Java code
    1. m2_home=/opt/maven/apache-maven-3.0
    2. Export M2_home
    3. Path= $PATH: $M 2_home/bin
    4. Export PATH



3. View version

Java code
    1. #cd/opt/maven/apache-maven-3.0/bin
    2. #mvn--version


If version information is displayed, it should be created under the ${user} directory. M2 directory

4. View. M2 Directory

Java code
    1. #cd/home/configer/.m2
    2. If you do not have a. M2 directory, you can manually add a
    3. #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
    1. #vi/opt/maven/apache-maven-3.0/conf/settings.xml
    2. Open the <localRepository>....</localRepository> comment in the file
    3. Or add in the file added under this comment
    4. <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
    1. #tar-zvxf nexus-oss-webapp-1.8. 0-bundle.tar.gz



2. Start Nexus

Java code
    1. #cd/opt/maven/nexus-oss-webapp-1.8. 0/BIN/JSW
    2. Select the version of your machine:
    3. #cd linux-x86-32/
    4. #./nexus start
    5. Restart:
    6. #./nexus restart
    7. Stop it:
    8. #./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
    1. Apache Snapshots
    2. Codehaus Snapshots
    3. 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
    1. Two of JBoss:
    2. http://repository.jboss.org/maven2/
    3. http://repository.jboss.org/nexus/content/repositories/releases/
    4. Sun's:
    5. http://download.java.net/maven/2/
    6. K-int's:
    7. http://developer.k-int.com/maven2/
    8. Because looking for Juel:juel-impl:2.2. 1 This jar package, so I also added a look for myself:
    9. http://repository.exoplatform.org/content/groups/public/



To add a step:

Java code
    1. 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
    1. 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.
    2. GAV Definition General Choice GAV Parameters
    3. Then add Group:Artifact:Version:Package
    4. 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
    1. <settings>
    2. <proxies>
    3. <proxy>
    4. <id>normal</id>
    5. <active>true</active>
    6. <protocol>http</protocol>
    7. <username>deployment</username>
    8. <password>deploy</password>
    9. 8081/nexus
    10. <port>80</port>
    11. <nonproxyhosts>localhost:8081/nexus</nonproxyhosts>
    12. </proxy>
    13. </proxies>
    14. <mirrors>
    15. <mirror>
    16. <!--this was used to direct the public snapshots Repo in the
    17. Profile Below a different Nexus group--
    18. <id>nexus-public-snapshots</id>
    19. <mirrorOf>public-snapshots</mirrorof>
    20. <url>http://localhost:8081/nexus/content/groups/public-snapshots</url>
    21. </mirror>
    22. <mirror>
    23. <!--this sends everything else
    24. <id>nexus</id>
    25. <mirrorOf>*</mirrorOf>
    26. <url>http://localhost:8081/nexus/content/groups/public</url>
    27. </mirror>
    28. </mirrors>
    29. <profiles>
    30. <profile>
    31. <id>development</id>
    32. <repositories>
    33. <repository>
    34. <id>central</id>
    35. <url>http://central</url>
    36. <releases><enabled>true</enabled></releases>
    37. <snapshots><enabled>true</enabled></snapshots>
    38. </repository>
    39. </repositories>
    40. <pluginRepositories>
    41. <pluginRepository>
    42. <id>central</id>
    43. <url>http://central</url>
    44. <releases><enabled>true</enabled></releases>
    45. <snapshots><enabled>true</enabled></snapshots>
    46. </pluginRepository>
    47. </pluginRepositories>
    48. </profile>
    49. <profile>
    50. <!--This profile would allow snapshots to beingsearched when activated-->
    51. <id>public-snapshots</id>
    52. <repositories>
    53. <repository>
    54. <id>public-snapshots</id>
    55. <url>http://public-snapshots</url>
    56. <releases><enabled>false</enabled></releases>
    57. <snapshots><enabled>true</enabled></snapshots>
    58. </repository>
    59. </repositories>
    60. <pluginRepositories>
    61. Font-size:1em; M

Linux installation configuration maven3.0 and setting up a Nexus

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.