这里用nexus搭建maven服务器: https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.17.0-01-win64.zip
并解压, 如下
用管理员权限开cmd,并进入nexus-3的bin目录 , 运行nexus /install安装服务, 然后用nexus /run运行. 第一次运行它需要从外网拉一些资料回来安装, 要等好一会.
完毕后, 在sonatype-work下有admin.password文件, notepad打开看里面是初始密码, 然后用chrome打开 http://localhost:8081, 用admin登入.
创建upload角色:
新建用户并赋于这个角色:
nexus服务器端已经设置完毕.
===========
下面对maven客户端进行配置, 打开conf/setting.xml,加上私服服务器
再加上私服认证帐号
切换回idea,在需要上传的maven module的pom.xml里面加上
<distributionManagement> <!-- 快照测试版本 --> <snapshotRepository> <id>nexus</id> <name>nexus snapshot</name> <url>http://xxxx:8081/repository/maven-snapshots/</url> </snapshotRepository> <!-- 发布版本 --> <repository> <id>nexus</id> <name>Nexus releases</name> <url>http://xxxx:8081/repository/maven-releases/</url> </repository> </distributionManagement>如果想连source一起打包,则需要在plugins里面加上:
<!-- 连源代码一起打包 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>3.0.1</version> <configuration> <attach>true</attach> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> -->
然后,用maven的面板的deploy?? 不行的, 怎么都说有错. 换为在idea的terminal里面运行mvn deploy就OK了.