第一步骤:下载nexus私服软件nexus-2.12.0-01-bundle
第二不:安装
进入nexus解压目录进入到bin目录:
1、安装:执行nexus.bat install
2、启动:nexus.bat start
第三步:查看访问路径
进入config目录,打开nexus.properties即可看到端口号,项目命令nexus。
第四步:浏览器打开http://127.0.0.1:8081/nexus/
默认登录账号:admin/admin123
# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus
# Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF私服使用说明:
Virtual 虚拟仓库
Proxy 代理仓库
Hosted 宿主仓库 本地仓库
Group 组
项目中如何使用:
项目中打包本地项目jar包上传到私服:
第一步:配置项目maven中setting配置文件,设置私服账号密码,才能上传到私服。
添加到settings.xml中:
<server>
      <id>releases</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
    <server>
      <id>snapshots</id>
      <username>admin</username>
      <password>admin123</password>
    </server>第二步:需要上传jia包项目的pom中配置私服地址
 <distributionManagement>
      <repository>
          <id>releases</id>
    <url>http://localhost:8081/nexus/content/repositories/releases/</url>
      </repository> 
      <snapshotRepository>
          <id>snapshots</id>
    <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
      </snapshotRepository> 
  </distributionManagement>第三步、要打包提交jar到私服的项目:
执行打包、提交到私服:
deploy
第四步:打开私服查看是否上传成功。
其他项目从私服下载jar包:
第一步:maven配置文件setting配置私服地址。
添加到settings.xml中
<profile>   
    <!--profile的id-->
    <id>dev</id>   
    <repositories>   
      <repository>  
        <!--仓库id,repositories可以配置多个仓库,保证id不重复-->
        <id>nexus</id>   
        <!--仓库地址,即nexus仓库组的地址-->
        <url>http://localhost:8081/nexus/content/groups/public/</url>   
        <!--是否下载releases构件-->
        <releases>   
          <enabled>true</enabled>   
        </releases>   
        <!--是否下载snapshots构件-->
        <snapshots>   
          <enabled>true</enabled>   
        </snapshots>   
      </repository>   
    </repositories>  
     <pluginRepositories>  
        <!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 -->
        <pluginRepository>  
            <!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 -->
            <id>public</id>  
            <name>Public Repositories</name>  
            <url>http://localhost:8081/nexus/content/groups/public/</url>  
        </pluginRepository>  
    </pluginRepositories>  
  </profile> 
激活maven配置文件中配置的私服仓库地址
  <activeProfiles>
    <activeProfile>dev</activeProfile>
  </activeProfiles>选择要拉取jar的项目,运行maven中的update,从私服拉取jar包。
注意:
安装nexus后,启动失败,可修改上面的nexus配置文件或从新安装jdk。
 
        
       
     
       
           
           
           
          
评论 (0)