http://www.sonatype.org/nexus/go
./nexus start
Nexus默认的端口是8081,可以在etc/nexus-default.properties配置中修改。
Nexus默认的用户名密码是admin/admin123
// 设置开机自启动
sudo ln -s /root/nexus/bin/nexus /etc/init.d/nexus
vim /etc/profile 加入export RUN_AS_USER=root
然而啥用都没有,启动还是一样的报这个提示。后面查看了一下启动脚本,即vim nexus,里面有一句:run_as_root=true ,原来是此处直接给拦死了,故只要改成run_as_root=false 就可以
service nexus status/start/stop
chkconfig nexus on/off
<!--http://www.cnblogs.com/sxdcgaq8080/p/7580964.html 有详细教程-->
<!--就是配置maven本地仓库的地址为自定义的地址-->
<localRepository>D:\apps\repository</localRepository>
<!--nexus服务器-->
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<!--组资源库的url地址 id和name自定义,mirrorOf的值设置为central,写死的-->
<mirrors>
<mirror>
<id>nexus</id>
<name>nexus repository</name>
<url>http://localhost:8081/repository/myself_group/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sxd.testP</groupId>
<artifactId>mavenProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<version>3.1</version>
</configuration>
</plugin>
</plugins>
</build>
<!-- 这一段是新添加的,这一段之外的都是创建maven项目时,它自己生成的pom.xml文件框架 -->
<dependencies>
<!-- junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>
</dependencies>
<!-- 这一段结束 -->
</project>
http://maven.aliyun.com/nexus/content/groups/public/
mvn deploy:deploy-file -DgroupId=sxd.jar -DartifactId=jacob -Dversion=1.18 -Dpackaging=jar -Dfile=G:\jar\jacob-1.18.jar -Durl=http://localhost:8081/repository/myself_hosted/ -DrepositoryId=myself_hosted
命令解释:
-DgroupId=sxd.jar 自定义
-DartifactId=jacob 自定义
-Dversion=1.18 自定义 三个自定义,构成pom.xml文件中的坐标
-Dpackaging=jar 上传的类型是jar类型
-Dfile=G:\jar\jacob-1.18.jar jar的本地磁盘位置
-Durl=http://localhost:8081/repository/myself_hosted/ hosted资源库的地址,下图中
-DrepositoryId=myself_hosted setting.xml文件中配置的ID