myeclipse发布jar到nexus私服上
第一步设置setting.xml:
<?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">
<localRepository>G:\Maven\Repository</localRepository>
<pluginGroups>
<pluginGroup>org.eclipse.jetty</pluginGroup>
</pluginGroups>
<servers>
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>youcash-mirror</id>
<mirrorOf>*</mirrorOf>
<url>http://172.16.240.9:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>central-override-profile</id>
<activation><activeByDefault>true</activeByDefault></activation>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
<snapshots><updatePolicy>always</updatePolicy><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
<snapshots><updatePolicy>always</updatePolicy><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
第二步设置mavne工程的pom
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.liu</groupId>
<artifactId>weizhi</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<!-- 用来支持项目发布到私服中,用来配合deploy插件的使用 -->
<distributionManagement>
<!-- 发布版本 -->
<repository>
<id>releases</id>
<name>releases</name>
<url>http://172.16.240.9:8081/repository/maven-releases/</url>
</repository>
<!-- 快照版本 -->
<snapshotRepository>
<id>snapshots</id>
<name>snapshots</name>
<url>http://172.16.240.9:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
记得repository的id releases和snapshots 必须要跟setting.xml保持一致。
只需要设置这步即可。
myeclipse上传jar到私服的操作:
右键工程,run as 选择maven build ....
在弹出界面的goals中输入 deploy -X 即可上传jar到私服。-X的意思,是maven的日志输出debug模式。
上传成功,不需要在pom中去引入插件plugins maven-deploy-plugins之类的