安装相关
1.我下载的版本nexus-3.7.0-04-unix.tar.gz
2.tar -zxvf 解压
3.进入bin目录
4../nexus run & 启动
5.设置开启启动
ln -s /jianbing/install/nexus/nexus-3.7.0-04/bin/nexus /etc/init.d/nexus3
chkconfig --add nexus3
chkconfig nexus3 on
6.修改启动用户为root
vim nexus.rc
7.修改nexus3启动时要使用的jdk版本
vim nexus 14行
设置成自己的javahome路径
8.修改nexus3默认端口
cd..../etc/
vim nexus-default.properties
9.修改nexus3数据以及相关日志的存储位置
cd /bin/
vim nexus.vmoptions
使用相关
setting.xml示例
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups />
<proxies />
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<localRepository>E:\newMaven\apache-maven-3.1.1\repo2</localRepository>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://101.37.116.225:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</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>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings> 复制代码
发布项目到nexus仓库配置POM文件
<distributionManagement>
<repository>
<id>nexus</id>
<name>Releases</name>
<url>http://{your-nexus-ip}/repository/maven-releases</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<name>Snapshot</name>
<url>http://{your-nexus-ip}/repository/maven-snapshots</url>
</snapshotRepository>
</distributionManagement>复制代码
使用命令发布项目:mvn clean deploy
手动上传jar
·没有pom文件的
mvn deploy:deploy-file -DgroupId=<group-id>
-DartifactId=<artifact-id>
-Dversion=<version>
-Dpackaging=<type-of-packaging>
-Dfile=<path-to-file>
-DrepositoryId=<id-to-map-on-server-section-of-settings.xml>
-Durl=<url-of-the-repository-to-deploy>复制代码
·带有pom文件的
mvn deploy:deploy-file -DpomFile=<path-to-pom>
-Dfile=<path-to-file>
-DrepositoryId=<id-to-map-on-server-section-of-settings.xml>
-Durl=<url-of-the-repository-to-deploy>复制代码