zoukankan      html  css  js  c++  java
  • maven nexus私服搭建,特别痛苦!!

    一、下载nexu,配置环境

    参考我的文章:http://www.cnblogs.com/quanyongan/archive/2013/04/24/3037589.html

    二、解压并准备Nexus安装目录:

    1、解压后有两上文件夹,分别是nexus-[version]和sonatype-work,
    第2个目录没用,主要是第1个。
    2、进入第1个目录,会发现和Tomcat的结构相似,因为Nexus默认集成了Jetty。
     

    3、在解压包第一层目录下,新建一个nexus文件夹

    4、复制路径C:Program FilesJava exus-2.14.1-01-bundle exus-2.14.1-01路径下的所有文件夹到C:Program FilesJava exus-2.14.1-01-bundle exus下

    5、点开C:Program FilesJava exus-2.14.1-01-bundle exus的lib文件夹,删除所有Jetty-*开头的包和javax.servlet-*包(图为删除后结果)。

    三、Tomcat配置:

    1、Tomcat可以配置成www.example.com或者带端口号的http访问ip地址http://localhost[:port]/nexus /

    2、打开tomcat所在的文件位置

     3、打开配置文件

    4、找到需要修改的文件

    5、双击打开servlet.xml文件

    6、(1)找到标签<Host>,将红圈部分加入

    <Context path="/nexus" docBase="nexus的路径" debug="1" reloadable="true" allowLinking="true"></Context>  

    (2)如果想像访问:www.baidu.com的形式访问nexus

    需要在增加下边代码:

    <Host name="repository.example.com" debug="0" appBase="webapp" unpackWARs="true" autoDeploy="false" xmlValidation="false"   xmlNamespaceAware="false">   <Context path="" docBase="nexus地址" debug="1" reloadable="true" allowLinking="true"></Context>  

    <Logger className="org.apache.catalina.logger.FileLogger" directory="logs"  prefix="nexus_log." suffix=".txt"   timestamp="true"/> </Host>  

     

    (3)配置好后,请访问你配置的地址,以localhost为例

    四、本地仓库镜像配置

    1、找到本地仓库的setting.xm。(查找请参考:参考我的文章:http://www.cnblogs.com/quanyongan/archive/2013/04/24/3037589.html)

     2、双击打开setting文件,加入如下代码

    原文如下:

    <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</id>
    <mirrorOf>*</mirrorOf>
    <url>http://localhost:8082/nexus/content/groups/public/</url>
    </mirror>
    </mirrors>
    <profiles>
    <profile>
    <id>nexus</id>
    <repositories>
    <repository>
    <id>central</id>
    <url>http://central</url>
    <releases><enabled>true</enabled></releases>
    <snapshots><enabled>true</enabled></snapshots>
    </repository>
    </repositories>
    <pluginRepositories>
    <pluginRepository>
    <id>central</id>
    <url>http://central</url>
    <releases><enabled>true</enabled></releases>
    <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
    </pluginRepositories>
    </profile>
    <profile>
    <id>public-snapshots</id>
    <repositories>
    <repository>
    <id>public-snapshots</id>
    <url>http://public-snapshots</url>
    <releases>
    <enabled>false</enabled>
    </releases>
    <snapshots>
    <enabled>true</enabled>
    </snapshots>
    </repository>
    </repositories>
    <pluginRepositories>
    <pluginRepository>
    <id>public-snapshots</id>
    <url>http://public-snapshots</url>
    <releases>
    <enabled>false</enabled>
    </releases>
    <snapshots>
    <enabled>true</enabled>
    </snapshots>
    </pluginRepository>
    </pluginRepositories>
    </profile>
    </profiles>
    <activeProfiles>
    <activeProfile>nexus</activeProfile>
    </activeProfiles>

    五、将项目发布到私服

     1、找到自己的项目,Myeclipse为例;

    2、打开pom.xml文件

    <project>节点里增加:
    <distributionManagement>
    <repository>
    <id>releases</id>
    <url>http://配置的host/nexus/content/repositories/releases</url>
    </repository>
    <snapshotRepository>
    <id>snapshots</id>
    <url>http://配置的host/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
    </distributionManagement>
    如图:

    3、执行,选中项目,右键run----->maven clean ,显示成功

    4、右键项目run------>maven build ..

    输入发布命令是:

    deploy
    5、发布成功样式

    6、查看私服中情况(找到snapshots(选中)下边的Browse Index 双击下边的文件夹---出现项目,就是配置成功了)

  • 相关阅读:
    20210108 android学习
    20210106 android学习
    20210105 android学习
    20210104 android学习
    httpClient请求转发个人理解
    CefSharp如何判断页面是否加载完
    C#/WPF 使用的Task线程程序缺依旧响应缓慢问题
    修改LiveChart的提示显示位置
    Wpf双击放大缩小界面
    WPF设置无边框CefSharp显示不出来问题
  • 原文地址:https://www.cnblogs.com/liuyangfirst/p/6187804.html
Copyright © 2011-2022 走看看