阿里倉庫配置
修改maven配置,如D:\apache-maven-3.6.0\conf\settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D:\workspace123\2019\.m2\repository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>alimaven</id>
</server>
</servers>
<mirrors>
<mirror>
<id>alimaven</id>
<mirrorOf>*</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
</profiles>
</settings>
在引用json-lib的時候,從 https://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.4 複製的
<!-- https://mvnrepository.com/artifact/net.sf.json-lib/json-lib -->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
</dependency>
運行run as>mvn install會報錯:
Failure to find net.sf.json-lib:json-lib:jar:2.4 in http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced -> [Help 1]
在線瀏覽阿里倉庫(可以找到各種jar和源碼jar) https://maven.aliyun.com/mvn/view 找到相應jar的依賴,發現多了一行<classifier>jdk15</classifier>,完整的如下:
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<!-- https://maven.aliyun.com/mvn/view的central的 /net/sf/json-lib/json-lib/2.4/json-lib-2.4-jdk15.jar -->
<classifier>jdk15</classifier>
</dependency>