nexus 搭建私服简单步骤

来源:互联网 发布:数字监控要网络吗 编辑:程序博客网 时间:2024/06/05 21:12

1. 下载nexus:http://www.sonatype.org/nexus/go, 我下载的是nexus-2.12.1-01-bundle.zip

2. 解压缩包到本地,包含两个文件夹:nexus-2.12.1-01, sonatype-work

3. 进入文件夹:nexus-2.12.1-01\bin\jsw\windows-x86-64, 启动nexus

C:\software\apache-maven-3.3.9\nexus-2.12.1-01\bin\jsw\windows-x86-64>console-nexus

4. open site: http://localhost:8081/nexus/

5. login with: admin/admin123

6. set true to 'download remote indexes'

  • 7 method 1

7.1. modify project pom.xml

   <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>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

7.2. execute command:

C:\software\apache-maven-3.3.9\lyrepo\my-webapp>mvn compile

will retrieve the jars from http://localhost:8081/nexus

  • 8. method 2: using mirror

8.1 set settings.xml

<mirror>  
      <id>my-org-repo</id>  
      <name>Repository in My Orgnization</name>  
      <url>http://localhost:8081/nexus/content/groups/public/</url>  
      <mirrorOf>central</mirrorOf>  
    </mirror> 

8.2. execute command:

C:\software\apache-maven-3.3.9\lyrepo\my-webapp>mvn compile

will retrieve the jars from http://localhost:8081/nexus



0 0
原创粉丝点击