https://www.sonatype.com/download-oss-sonatype
进入 bin 目录,启动 Nexus 。
我使用的是 Mac,执行 ./nexus run
http://localhost:8081/ 就可以访问了,默认管理员账号密码是admin admin123
注意配置文件在这个地方。
<?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">
<servers>
<server>
<id>maven-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>maven-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
</settings>
<groupId>com.ggstar</groupId>
<artifactId>ipdatabase</artifactId>
<version>1.0.0</version>
<distributionManagement>
<repository>
<id>maven-releases</id>
<url>http://localhost:8081/repository/maven-releases/</url>
</repository>
</distributionManagement>
<build>
<defaultGoal>compile</defaultGoal>
</build>
这边distributionManagement中的id要跟上面的配置的id一样。然后点击右边的deploy即可发布。
我在第2步遇到配置写错了,导致一直失败,可以在项目的根目录下执行 mvn -X来进行调试
还可以用mvn clean deploy 来直接发布。
4141