用私服修复Maven仓库依赖引用(加载)不下来的问题

一、我在我的项目中向引用一Maven包
在Maven仓库中是有这个依赖的
Maven仓库
这里写图片描述

二、我照着在Maven中依赖地址,在项目Pom.xml文件中引用了该依赖

<!-- https://mvnrepository.com/artifact/org.ethereum/ethereumj-core -->
<dependency>
    <groupId>org.ethereum</groupId>
    <artifactId>ethereumj-core</artifactId>
    <version>1.7.2-RELEASE</version>
</dependency>

三、但是我在启动项目的时候,再编译的时候就不能通过,会报这个包相关的一系列问题
这里写图片描述
具体如下:
大意就是中央仓库没有这个包

[ERROR] Failed to execute goal on project usdgservice: Could not resolve dependencies for project com.gws:usdgservice:jar:1.0.0: 
Failure to find org.ethereum:solcJ-all:jar:0.4.8 in http://central.maven.org/maven2/ was cached in the local 
repository, resolution will not be reattempted until the update interval of central-repository has elapsed or updates are forced -> [Help 1]

那么就奇怪啦,为什么明明有的却看不到呢?

四、那么来看一下整个以太坊的包的情况
尽管活跃度很高,但是可以看到使用量都为0。
证明想要靠利用中央仓库引用这个Jar吧现阶段是不能够的。
这里写图片描述

五、那么现在就需要发挥我们的私服的优势了
首先将包下载下来
这里写图片描述

六、在私服中上传包
这里写图片描述

Group、Artfact和Version要和引用的一样,packaging选择对应上传包的后缀,例如jar包。

<!-- https://mvnrepository.com/artifact/org.ethereum/ethereumj-core -->
<dependency>
    <groupId>org.ethereum</groupId>
    <artifactId>ethereumj-core</artifactId>
    <version>1.7.2-RELEASE</version>
</dependency>

注意:
1.Select Artifact(s) to Upload可以选择本地需要上传的包。
Classifier不填。
2.Add Artifact将选定的文件添加进来。
3.Upload Artifact(s) 上传文件。

七、上传完成后,看看是否和项目中Pom.xml一样。
这里写图片描述

八、最后再启动本地的项目就会发现一切Ok了。
当然:maven的settings.xml一定要添加自己的Maven私服配置。

settings.xml
   <mirror>
      <id>fzm-nexus</id>
      <name>Central Repository</name>
      <mirrorOf>*</mirrorOf>
      <url>http://114.55.91.220:8081/nexus/content/groups/public</url>
    </mirror>

九、最后启动,会发现一切都好啦。

猜你喜欢

转载自blog.csdn.net/wd2014610/article/details/80273062