Nexus builds Maven private service Maven installation

Maven installation

download address: http://maven.apache.org/download.htmlDownload

(this version is 3.0.4): wget http://mirror.bjtu.edu.cn/apache/maven/binaries/apache-maven -3.0.4-bin.tar.gz

decompression and installation: tar -xvzf apache-maven-3.0.4-bin.tar.gz

maven environment configuration: add

export M2_HOME=../apache-maven-3.0.4

export PATH=$PATH:$M2_HOME/bin

to make the environment effective source /etc/profile

test maven installation successful mvn -v

Nexus website http://www.sonatype.org/nexus/

download http://nexus. sonatype.org/downloads/

Nexus provides two installation methods, one is the bundle with embedded Jetty, as long as you have JRE, you can run it directly. The second way is WAR, you just need to simply publish it to the web container and use it.

Extract the tar xvzf nexus-2.0-

bundle.tar.gz into cd ...bin/jsw/linux-x86-64/ Just run ./nexus start in .

http://localhost:8081/nexus to enter. The default username and password is admin/admin123.



By default, nexus disables the remote index download function, mainly because it will cause a huge burden on the server, and we need to manually enable it.

How to open:
Click Repositories under the Administration menu, and change the Download Remote Indexes of the three warehouses Apache Snapshots, Codehaus Snapshots, and Maven Central to true. Then right-click on the three warehouses and select Re-index, so that Nexus will download the remote index file.



To make maven use nexus as a private server, you need to do some settings, using a method similar to the original setting of artifactory. Modify ~/.m2/settings.xml.

Increase the nexus profile:
<profiles>

<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url>http://ip:8081/nexus/content/groups/public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus</name>
<url>http://ip:8081/nexus/content/groups/public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled> </snapshots>
</pluginRepository>
</pluginRepositories>

</profile>

</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>


Mirrors:

If you have a faster central mirror near your geographic location, or you want to override the central repository configuration, or you want to use only one remote for all POMs (this remote proxy for all necessary other repositories), You can use the mirror configuration in settings.xml.

<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<name>Nexus</name>
<url>http://[color=red]IP[/color]:8081/nexus/content/groups/public/</url>
</mirror>

 

<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<name>Nexus</name>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Nexus</name>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled> </snapshots>
</pluginRepository>
</pluginRepositories>

</profile>


This configuration overrides the central warehouse configuration with Maven private server, so that Maven's component download requests for any warehouse will be transferred to the private server. You

need to start the maven private server service and add nexus/bin/jsw/linux

to /etc/rc.d/rc.local -x86-64/nexus start



recommends several good Maven common repository URLs:
http://mvnrepository.com/
http://search.maven.org/
http://repository.sonatype.org/content/groups/public /
http://people.apache.org/repo/m2-snapshot-repository/
http://people.apache.org/repo/m2-incubating-repository/

Reproduced from: http://www.l99.com/ EditText_view.action?textId=458901

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326309601&siteId=291194637