Maven 自动打包上传到私服 Nexus
2018-02-26 16:28
309 查看
配置
<distributionManagement >
<repository >
<id >releases </id >
<url >http://vrouter.lz-oa.com:8081/nexus/content/repositories/releases/ </url >
</repository >
<snapshotRepository >
<id >Snapshots </id >
<url >http://vrouter.lz-oa.com:8081/nexus/content/repositories/snapshots</ url>
</snapshotRepository >
</distributionManagement >
<servers>
<server>
<id>releases</id>
<username>admin</username>
<password>qsapwd</password>
</server>
<server>
<id>Snapshots</id>
<username>admin</username>
<password>qsapwd</password>
</server>
</servers>
<build>
<plugins>
<plugin> <!-- 打jar包 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<excludes>
<exclude>**/*.properties</exclude>
</excludes>
</configuration>
</plugin>
<plugin> <!-- 打源码 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Maven 打源码包,并上传私服
Maven获取jar的默认顺序是 1. Releases 在发布库里面查找(主要用于稳定版) 2. Snapshots 在快照库里面查找(和上面的区别就是在pom加了个<version>0.0.5-SNAPSHOT</version>,主要用于开发阶段) 3. 3rd party 不是我们自己开发的,也在中央库找不到的,就要到这里手动上传包到私服。 4. Central 到中央库查找。 上传私服 pom.xml 配置
<distributionManagement >
<repository >
<id >releases </id >
<url >http://vrouter.lz-oa.com:8081/nexus/content/repositories/releases/ </url >
</repository >
<snapshotRepository >
<id >Snapshots </id >
<url >http://vrouter.lz-oa.com:8081/nexus/content/repositories/snapshots</ url>
</snapshotRepository >
</distributionManagement >
settings.xml 配置
<servers>
<server>
<id>releases</id>
<username>admin</username>
<password>qsapwd</password>
</server>
<server>
<id>Snapshots</id>
<username>admin</username>
<password>qsapwd</password>
</server>
</servers>
打包源码 pom.xml 配置
<build>
<plugins>
<plugin> <!-- 打jar包 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<excludes>
<exclude>**/*.properties</exclude>
</excludes>
</configuration>
</plugin>
<plugin> <!-- 打源码 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Maven 打源码包,并上传私服
1. 使用命令行 cmd 进入到项目根目录执行:mvn clean source:jar package 会生成两个jar,其中有一个是源码的jar,分别使用相同的groupId和artifactId。 也可以直接,打包并上传私服,使用命令:deploy -e 2. 使用Eclipse 右击项目 Run as →Maven bulid,在Goals输入deploy -e。
相关文章推荐
- Maven打包自动发布到nexus私服
- maven/gradle 打包后自动上传到nexus仓库
- maven自动打包上传nexus仓库配置
- maven/gradle 打包后自动上传到nexus仓库
- maven 打包上传到私服
- maven/gradle 打包后自动上传到nexus仓库
- maven上传jar包到nexus私服后的存放路径
- MyEclipse 配置maven项目pom.xml设置 上传项目到nexus私服,通过中转仓库下载插件,以及nexus的配置
- maven私服注意问题-nexus搭建maven私服及私服jar包上传和下载
- linux下 nexus搭建maven私有库 自动打包
- maven/gradle 打包后自动上传到nexus仓库---学习笔记
- Maven配置jar(war)包自动打包上传Maven服务器的配置
- nexus搭建maven私服及私服jar包上传和下载
- 在nexus手动上传jar包到maven私服
- Java开发流程自动化(svn+maven+nexus+jenkins) --自动编译,持续集成,测试,打包,发布/部署
- maven上传jar到nexus私服仓库
- maven打包上传到私服
- maven上传第三方jar到nexus私服
- Maven项目的打包发布到Nexus私服和服务器