Install a .Nexus
1.Nexus Introduction
- Maven repository is a special company for general
2.Nexus installation
Go https://www.sonatype.com/oss-thank-you-win64.zip download and unzip the following
- Run the installation PW (execute commands with administrator privileges to install PW under dos)
nexus.exe / install // install
nexus.exe / uninstall // unload
net start nexus // start
net stop nexus // stop
3. Configure Nexus
nexus-default.properties etc directory in the Nexus port configuration, IP, context path
- application-host: Host Nexus listening service
- application-port: Nexus service listening port
- nexus-context-path: Nexus service context path
4. Start Services
5. Locate the url PW
http://localhost:8081/nexus/#welcome
log in
默认用户 密码
admin/admin123
II. PW warehouse type
- hosted: Host warehouse (storage jar package developed by the Company (the official version beta version of a third party: the existence of copyright issues -Oracle))
- proxy: Proxy warehouse (the central warehouse agent, apache test version of the jar package)
- group: Group warehouse (depot future connecting group comprising Hosted:. warehouse host, proxy: Warehouse agent)
- virtual: virtual warehouse (was abandoned warehouse)
III. Upload jar package to PW
1. In maven directory conf / setting.xml authentication: Configure the user name and password
<servers>
<server>
<id>releases</id> <!--宿主仓库-->
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id><!--宿主仓库-->
<username>admin</username>
<password>admin123</password>
</server>
</servers>
2. Configure jar package upload path url in pom.xml to be uploaded project
- We upload ssh-dao
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8081/nexus/repository/maven-releases</url><!--私服对应url-->
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8081/nexus/repository/maven-snapshots</url><!--私服对应url-->
</snapshotRepository>
</distributionManagement>
3. Run the project to publish PW (upload) - execution deploy
IV. Downloaded from the PW jar package to a local warehouse
1. In maven directory conf / setting.xml configuration template
<profile>
<!--profile的id-->
<id>dev</id>
<repositories>
<repository>
<!--仓库id,repositories可以配置多个仓库,保证id不重复-->
<id>nexus</id>
<!--仓库地址,即nexus仓库组的地址-->
<url>http://localhost:8081/nexus/repository/maven-public</url>
<!--是否下载releases构件-->
<releases><enabled>true</enabled></releases>
<!--是否下载snapshots构件-->
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<!--插件仓库,maven的运行依赖插件,也需要从私服下载插件-->
<pluginRepository>
<!--插件仓库的id不允许重复,如果重复后边配置会覆盖前边-->
<id>public</id>
<name>Public Repositories</name>
<url>http://localhost:8081/nexus/repository/maven-public</url>
</pluginRepository>
</pluginRepositories>
</profile>
2. Activate the template (also on setting.xml under the maven)
<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>
3. Test Download
- We went to the local repository of the corresponding jar package overall project deleted
- The project has not found error, because each project is open, it is dependent on the project, instead of the jar package
- Turn off ssh-dao project, after being given the go download the PW, after viewing the local repository and there is a corresponding package