Linux installation configuration maven and a Nexus

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

http://nlslzf.iteye.com/blog/812995

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
<Settings>    <proxies>      <Proxy>        <ID>Normal</ID>        <Active>True</Active>        <Protocol>http</Protocol>        <username>Deployment</username>        <Password>Deploy</Password>        <Host>Localhost:8081/nexus</Host>        <Port>80</Port>        <nonproxyhosts>Localhost:8081/nexus</nonproxyhosts>      </Proxy>    </proxies>      <Mirrors>      <Mirror>        <!--This was used to direct the public snapshots repo in the profiles below over to 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 to/public -        <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 being searched 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>

Linux installation configuration maven and 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.