myeclipse6.5使用maven私服
1、修改用户全局配置
C:\Documents and Settings\Administrator\.m2\settings.xml
该文件修改为:
<settings 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/settings-1.0.0.xsd">
<profiles>
<!--这是私服一-->
<profile>
<id>MirrorRepository</id>
<repositories>
<repository>
<id>central</id>
<url>
http://192.168.10.253:8081/artifactory/repo
</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>
http://192.168.10.253:8081/artifactory/repo
</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>
http://192.168.10.253:8081/artifactory/plugins-releases
</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshots</id>
<url>
http://192.168.10.253:8081/artifactory/plugins-snapshots
</url>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>MirrorRepository</activeProfile>
</activeProfiles>
</settings>
2、项目的pom.xml中就不用配置私服信息
pom.xml内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.megaeyes</groupId>
<artifactId>Mail2Jms2</artifactId>
<packaging>war</packaging>
<name />
<version>0.0.1-SNAPSHOT</version>
<description />
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.9</version>
</dependency>
</dependencies>
</project>
1、修改用户全局配置
C:\Documents and Settings\Administrator\.m2\settings.xml
该文件修改为:
<settings 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/settings-1.0.0.xsd">
<profiles>
<!--这是私服一-->
<profile>
<id>MirrorRepository</id>
<repositories>
<repository>
<id>central</id>
<url>
http://192.168.10.253:8081/artifactory/repo
</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>
http://192.168.10.253:8081/artifactory/repo
</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>
http://192.168.10.253:8081/artifactory/plugins-releases
</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshots</id>
<url>
http://192.168.10.253:8081/artifactory/plugins-snapshots
</url>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>MirrorRepository</activeProfile>
</activeProfiles>
</settings>
2、项目的pom.xml中就不用配置私服信息
pom.xml内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.megaeyes</groupId>
<artifactId>Mail2Jms2</artifactId>
<packaging>war</packaging>
<name />
<version>0.0.1-SNAPSHOT</version>
<description />
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.9</version>
</dependency>
</dependencies>
</project>
MyEclipse配置Maven私服
本文介绍如何在MyEclipse 6.5环境中通过修改用户全局配置文件settings.xml来设置Maven私服,并展示了具体的配置代码。此外还提供了一个不包含私服信息的pom.xml示例。
1045

被折叠的 条评论
为什么被折叠?



