本地maven倉庫使用及配置


本地倉庫的創建

下載 nexus-2.11.4-01-bundle.zip 解壓並運行C:\nexus-2.11.4-01-bundle\nexus-2.11.4-01\bin\jsw\windows-x86-64\console-nexus.bat (不同系統選擇不同目錄)

http://127.0.0.1:8081/nexus/登錄,admin/admin123

更新central ,codehanus snapshots,apache snapshots 的download remote index為true,

 

如果需要存放自定義的jar包,選擇 3rd party, 選擇artifact upload,設置好相關信息,選擇jar包並上傳,在browse index中可以看見成功的jar包及

xml

如:

<dependency>
  <groupId>xiao.chang.wei</groupId>
  <artifactId>xiaotest</artifactId>
  <version>2.0.1</version>
</dependency>

 

將此xml拷貝到pom.xml中即可加載相應的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>com.xiao</groupId>
    <artifactId>Test001</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
        <argLine>-Dfile.encoding=UTF-8</argLine>
    </properties>
    
    <repositories>
        <repository>
            <id>nexus</id>
            <name>Team Nexus Repository</name>
            <url>http://localhost:8081/nexus/content/groups/public</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>nexus</id>
            <name>Team Nexus Repository</name>
            <url>http://localhost:8081/nexus/content/groups/public</url>
        </pluginRepository>
    </pluginRepositories>

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>xiao.chang.wei</groupId>
            <artifactId>xiaotest</artifactId>
            <version>2.0.1</version>
        </dependency>
    </dependencies>

</project>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM