install nexus 2.x first , need java 1.7+
https://www.sonatype.com/download-oss-sonatype
config nexus
Add a user user
pass pass
, grant privilege
For example a project named InitialD
Add a repository InitialD-release
Add a repository InitialD-snapshot
install maven 3.x
Add environment variable MAVEN_HOME
to the maven dirctory.
Modify environment variable path
add ;%M2_HOME%\bin
http://maven.apache.org/download.cgi
config maven
Modify %MAVEN_HOME%/conf/settings.xml
add servers-server / profile-repositories-repository
server:1
2
3
4
5
6
7
8
9
10<server>
<id>InitialD-release</id>
<username>user</username>
<password>pass</password>
</server>
<server>
<id>InitialD-snapshot</id>
<username>user</username>
<password>pass</password>
</server>
repositorie:1
2
3
4
5
6
7
8<repository>
<id>InitialD-release</id>
<url>http://127.0.0.1:8081/nexus/content/repositories/InitialD-release</url>
</repository>
<repository>
<id>InitialD-snapshot</id>
<url>http://127.0.0.1:8081:8081/nexus/content/repositories/InitialD-snapshot</url>
</repository>
Intelij config
change maven to self define package/ configure:
modify pom.xml in intelij project:1
2
3
4
5
6
7
8
9
10
11
12
13<distributionManagement>
<repository>
<id>dms-release</id>
<name>Team Nexus Release Repository</name>
<url>http://127.0.0.1:8081/nexus/content/repositories/InitialD-release</url>
</repository>
<snapshotRepository>
<id>dms-snapshots</id>
<name>Team Nexus Snapshot Repository</name>
<url>http://127.0.0.1:8081/nexus/content/repositories/InitialD-snapshot</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
use maven plugin deploy package:
https://www.cnblogs.com/lyy-2016/p/5747631.html
https://blog.csdn.net/win7system/article/details/51252275
https://www.cnblogs.com/mfrbuaa/p/5408185.html