maven打包jar上传远程仓库

xiaoxiao2021-02-28  49

maven打包jar上传远程仓库

创建角色、用户

查看远程仓库地址

setting.xml文件设置

这里的id要和远程地址仓库中的ID一致

<server> <id>releases</id> <username>dev</username> <password>密码</password> </server> <server> <id>snapshots</id> <username>dev</username> <password>密码</password> </server>

pom.xml文件设置

可以分别上传releases版本和snapshots版本,两种版本区分点在于releases不覆盖,snapshots覆盖本地版本

<groupId>com.km.core</groupId> <artifactId>km-core</artifactId> <version>2.0.8-SNAPSHOT</version>

远程地址和图片上一致

<distributionManagement> <repository> <id>releases</id> <url>http://192.168.96.23:8081/nexus/content/repositories/releases</url> </repository> <snapshotRepository> <id>snapshots</id> <url>http://192.168.96.23:8081/nexus/content/repositories/snapshots</url> </snapshotRepository> </distributionManagement>

编译上传远程仓库带源码

<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>3.0.1</version> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin> </plugins> </build>

版权声明

作者:苏陌年 出处:http://www.zhengzy.top/ 版权所有,欢迎保留原文链接进行转载:)

转载请注明原文地址: https://www.6miu.com/read-63964.html

最新回复(0)