maven 从私仓库下载jar包

pom.xml

<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>test1</groupId>
  <artifactId>test1</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
      
  <dependencies>
         <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
        </dependency> 
        <dependency>
          <groupId>fakepath</groupId>
          <artifactId>test3</artifactId>
          <version>0.0.2</version>
       </dependency>
     
  </dependencies>
  <!-- 私有仓库 -->
   <repositories>
        <repository>
            <id>thirdparty</id>
            <name>Team Nexus Repository</name>
            <url>http://192.168.1.130:8081/nexus/content/repositories/thirdparty</url>
        </repository>
      </repositories>
  <!-- 私有仓库 -->
      <pluginRepositories>
          <pluginRepository>
              <id>nexus</id>
              <name>local nexus</name>
              <url>http://192.168.1.130:8081/nexus/content/groups/public</url>
              <releases>
                  <enabled>true</enabled>
              </releases>
              <snapshots>
                  <enabled>true</enabled>
              </snapshots>
          </pluginRepository>
      </pluginRepositories>
      <build>
            <defaultGoal>package</defaultGoal>
            <finalName>${project.artifactId}</finalName>

            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>

            </plugins>
     </build>
</project>

settings.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">
    
    <pluginGroups></pluginGroups>
    <proxies></proxies>
    
    <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>nexus-releases</id>
            <mirrorOf>*</mirrorOf>
            <url>http://192.168.1.130:8081/nexus/content/groups/public</url>
        </mirror>
        <mirror>
            <id>nexus-snapshots</id>
            <mirrorOf>*</mirrorOf>
            <url>http://192.168.1.130:8081/nexus/content/groups/public-snapshots</url>
        </mirror>
    </mirrors>
    
    <profiles>
        <profile>
            <id>nexus</id>
            <repositories>
                <repository>
                    <id>maven-nexus-public</id>
                    <name>Team Nexus Repository</name>
                    <url>http://192.168.1.130:8081/nexus/content/groups/public</url>
                </repository>
                <repository>
                    <id>release</id>
                    <name>Team Nexus Repository</name>
                    <url>http://192.168.1.130:8081/nexus/content/repositories/releases</url>
                </repository>
                <repository>
                    <id>snapshots</id>
                    <name>Team Nexus Repository</name>
                    <url>http://192.168.1.130:8081/nexus/content/repositories/snapshots</url>
                </repository>
                <repository>
                    <id>thirdparty</id>
                    <name>Team Nexus Repository</name>
                    <url>http://192.168.1.130:8081/nexus/content/repositories/thirdparty</url>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>nexus-releases</id>
                    <url>http://nexus-releases</url>
                    <releases><enabled>true</enabled></releases>
                    <snapshots><enabled>true</enabled></snapshots>
                </pluginRepository>
                <pluginRepository>
                    <id>nexus-snapshots</id>    
                    <url>http://nexus-snapshots</url>    
                    <releases><enabled>true</enabled></releases>    
                    <snapshots><enabled>true</enabled></snapshots>    
                </pluginRepository>    
            </pluginRepositories>    
        </profile>    
    </profiles>    
    
    <activeProfiles>    
        <activeProfile>nexus</activeProfile>    
    </activeProfiles>    
    
</settings>

 

posted on 2017-06-02 16:20  AlexGeng  阅读(4504)  评论(0编辑  收藏  举报

导航