码迷,mamicode.com
首页 > 其他好文 > 详细

maven私服搭建

时间:2020-01-24 00:06:04      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:连接状态   alibaba   ali   tac   oca   erro   版本   自带   文件   

maven私服搭建

搭建私服的工具选择

Apache基金会的archiva

http://archiva.apache.org/

JFrog的Artifactory

https://jfrog.com/artifactory/

Sonatype的Nexus

https://my.sonatype.com/
这些都是开源的私服软件,都可以自由使用。用的最多的是第三种Nexus,本文我们主要以这个来讲解,其他2种有兴趣的朋友可以去研究一下。

Windows10中安装Nexus私服
nexus是java开发的,所以运行的时候需要有java环境的支持。

nexus下载和版本

https://www.sonatype.com/nexus-repository-oss

nexus-3.20.1-01-win64

C:\Users\jie>java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

nexus启动

nexus.exe /run

D:\chengxu\nexus-3.20.1-01-win64\nexus-3.20.1-01\bin>nexus.exe /run
2020-01-23 20:52:01,237+0800 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.pax.logging.NexusLogActivator - start
2020-01-23 20:52:03,362+0800 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.features.internal.FeaturesWrapper - Fast FeaturesService starting
2020-01-23 20:56:54,923+0800 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer -
-------------------------------------------------

Started Sonatype Nexus OSS 3.20.1-01

-------------------------------------------------

浏览器访问

http://localhost:8081/

其他版本可能需要输入:http://localhost:8081/nexus

登录

需要修改密码

Your admin user password is located in
D:\chengxu\nexus-3.20.1-01-win64\sonatype-work\nexus3\admin.password on the server.

修改启动端口

默认端口是8081,如果和本机有冲突,可以在下面的文件中修改:

${dir}\etc\nexus-default.properties

nexus仓库类型

上图中是nexus安装好默认自带的仓库列表,主要有3种类型:

代理仓库

宿主仓库

仓库组

技术图片

技术图片

下载组件

<server>
    <id>maven_mozq</id>
    <username>admin</username>
    <password>admin</password>
</server>
<dependencies>
    <!-- https://mvnrepository.com/artifact/com.alibaba/druid -->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid</artifactId>
        <version>1.1.18</version>
    </dependency>
</dependencies>
<repositories>
    <repository>
        <id>maven_mozq</id>
        <url>http://localhost:8081/repository/maven-public/</url>
    </repository>
</repositories>
D:\00\01>mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.mozq.dubbo:demo-01-provider >-------------------
[INFO] Building demo-01-provider 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from maven_mozq: http://localhost:8081/repository/maven-public/com/alibaba/druid/1.1.18/druid-1.1.18.jar
Downloading from alimaven: http://maven.aliyun.com/nexus/content/groups/public/com/alibaba/druid/1.1.18/druid-1.1.18.jar
Downloaded from alimaven: http://maven.aliyun.com/nexus/content/groups/public/com/alibaba/druid/1.1.18/druid-1.1.18.jar (2.8 MB at 645 kB/s)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ demo-01-provider ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\00\01\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ demo-01-provider ---
[INFO] No sources to compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  35.810 s
[INFO] Finished at: 2020-01-23T22:41:29+08:00
[INFO] ------------------------------------------------------------------------
D:\00\01>mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.mozq.dubbo:demo-01-provider >-------------------
[INFO] Building demo-01-provider 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from maven_mozq: http://localhost:8081/repository/maven-public/com/alibaba/druid/1.1.18/druid-1.1.18.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/alibaba/druid/1.1.18/druid-1.1.18.jar
Progress (1): 0.1/2.8 MB
D:\00\01>mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.mozq.dubbo:demo-01-provider >-------------------
[INFO] Building demo-01-provider 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from maven_mozq: http://localhost:8081/repository/maven-public/com/alibaba/druid/1.1.18/druid-1.1.18.jar
Downloaded from maven_mozq: http://localhost:8081/repository/maven-public/com/alibaba/druid/1.1.18/druid-1.1.18.jar (2.8 MB at 103 kB/s)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ demo-01-provider ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\00\01\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ demo-01-provider ---
[INFO] No sources to compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  28.263 s
[INFO] Finished at: 2020-01-23T22:57:20+08:00
[INFO] ------------------------------------------------------------------------

bugs

不能启动nexus

D:\chengxu\nexus-3.20.1-01-win64\nexus-3.20.1-01\bin>nexus.exe

D:\chengxu\nexus-3.20.1-01-win64\nexus-3.20.1-01\bin>nexus.exe  /

D:\chengxu\nexus-3.20.1-01-win64\nexus-3.20.1-01\bin>nexus.exe  /start
Could not start service. Error code: 1060
方案:
nexus.exe /run

浏览器访问报404

D:\00\01>mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.mozq.dubbo:demo-01-provider >-------------------
[INFO] Building demo-01-provider 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from maven_mozq: http://localhost:8081/repository/maven-public/com/alibaba/druid/1.1.18/druid-1.1.18.pom
Downloading from alimaven: http://maven.aliyun.com/nexus/content/groups/public/com/alibaba/druid/1.1.18/druid-1.1.18.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.567 s
[INFO] Finished at: 2020-01-23T22:25:44+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project demo-01-provider: Could not resolve dependencies for project com.mozq.dubbo:demo-01-provider:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.alibaba:druid:jar:1.1.18: Failed to read artifact descriptor for com.alibaba:druid:jar:1.1.18: Could not transfer artifact com.alibaba:druid:pom:1.1.18 from/to alimaven (http://maven.aliyun.com/nexus/content/groups/public/): maven.aliyun.com: Unknown host maven.aliyun.com -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

ready to connect和manually blocked

需要在仓库中将Block相关的选项去除勾选。
1 Block outbound connections on the repository
2 Auto-block outbound connections on the repository if remote peer is detected as unreachable/unresponsive
等待连接状态不用管,使用的请求下载jar,就会自动变为remote available

maven私服搭建

标签:连接状态   alibaba   ali   tac   oca   erro   版本   自带   文件   

原文地址:https://www.cnblogs.com/mozq/p/12231645.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!