maven 上传私服
1.配置maven的settings配置.其中包含私服地址,账户等信息.
2.在idea中关联maven配置文件settings
关联settings
3.pom中配置私服地址
<!-- 使用分发管理将本项目打成jar包,直接上传到指定服务器 -->
<distributionManagement>
<!--正式版本-->
<repository>
<!-- nexus服务器中用户名:在settings.xml中<server>的id-->
<id>yang</id>
<!-- 这个名称自己定义 -->
<name>Release repository</name>
<!-- 上传的私服路径 -->
<url>http://192.168.3.105:8081/repository/yang/</url>
</repository>
<!--快照
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Snapshots repository</name>
<url>http://192.168.1.105/repository/yang/</url>
</snapshotRepository>
-->
</distributionManagement>
4.pom中添加maven-source-plugin插件.(上传源码)
4.1单环境
<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的Lifecycle点击deploy来上传.
4.2多环境(配置develop环境)
将maven-source-plugin插件作用于develop环境
<profiles>
<profile>
<id>develop</id>
<build>
<plugins>
<!-- 打source包 -->
<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>
</plugins>
</build>
</profile>
</profiles>
在profiles中选择develop来选择应用环境,再点击deploy来上传.