nexus搭建maven私服

  1. 从官网http://www.sonatype.org/nexus/go下载nexus安装包(例如:nexus-2.14.3-02-bundle.zip)

  2. 解压缩后进入 盘符:\nexus-2.14.3-02-bundle\nexus-2.14.3-02\bin\jsw中选择相应的系统安装文件夹nexus搭建maven私服_第1张图片这里我选择window-x86-64位的

  3. 进入window-x86-64中,有以下几个文件nexus搭建maven私服_第2张图片,执行install-nexus.bat安装服务

  4. 打开浏览器,输入http://localhost:8081/nexus/进入nexus管理页面

  5. 点击右上角的log in登陆,默认用户名/密码是admin/admin123

  6. 仓库介绍
    nexus搭建maven私服_第3张图片

  7. 账户管理
    nexus搭建maven私服_第4张图片

  8. 手动上传jar包
    nexus搭建maven私服_第5张图片
    nexus搭建maven私服_第6张图片
    上传的jar包位置
    nexus搭建maven私服_第7张图片

  9. 通过pom.xml上传jar包

    • 在eclipse中新建一个maven项目,打开pom.xml文件
    • 在pom.xml中输入如下代码指定上传的路径
 <distributionManagement>
    <repository>
        <id>releaseUserid>
        <name>adminname>
 <url>http://localhost:8081/nexus/content/repositories/releases/url>
    repository>
    <snapshotRepository>
        <id>snapshotsUserid>
        <name>adminname>
        <url>http://localhost:8081/nexus/content/repositories/snapshots/url>
    snapshotRepository>
  distributionManagement>

再右键项目,选择run as–》maven build–》run即可上传jar包

  1. 引用maven私服的jar包
    在pom.xml中输入如下代码
<repositories>
          <repository>
              <id>nexusid>
              <name>Team Nexus Repositoryname>
              <url>http://localhost:8081/nexus/content/groups/publicurl>
          repository>
      repositories>
      <pluginRepositories>
          <pluginRepository>
             <id>nexusid>
             <name>Team Nexus Repositoryname>
             <url>http://localhost:8081/nexus/content/groups/publicurl>
         pluginRepository>
     pluginRepositories>
     <dependencies>
         <dependency>
             <groupId>com.oraclegroupId>
             <artifactId>ojdbcartifactId>
             <version>10.1.0.2.0version>
         dependency>
     dependencies>

可以引用私服的jar包
其中repository为仓库地址,pluginRepository为插件地址

你可能感兴趣的:(Maven)