关于maven中下载导入json JAR包的问题 Missing artifact net.sf.json-lib:json-lib:jar:2.2.3:compile 20
mvncleaninstall编译时报错为:[INFO]Failedtoresolveartifact.Missing:----------1)net.sf.json-l...
mvn clean install 编译时报错为:
[INFO] Failed to resolve artifact.
Missing:
----------
1) net.sf.json-lib:json-lib:jar:2.2.3
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=net.sf.json-lib -DartifactId=json-lib -Dversion=2.2.3 -Dpackaging=jar -Dfile=/p
ath/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=net.sf.json-lib -DartifactId=json-lib -Dversion=2.2.3 -Dpackaging=jar -Dfile=/pat
h/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.apache.struts:ServiceSystem:war:0.0.1-SNAPSHOT
2) net.sf.json-lib:json-lib:jar:2.2.3
----------
1 required artifact is missing.
for artifact:
org.apache.struts:ServiceSystem:war:0.0.1-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
pom.xml中的配置为
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.2.3</version>
</dependency>
这个配置文件写的有问题么?
这个一开始试了 还是不行 展开
[INFO] Failed to resolve artifact.
Missing:
----------
1) net.sf.json-lib:json-lib:jar:2.2.3
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=net.sf.json-lib -DartifactId=json-lib -Dversion=2.2.3 -Dpackaging=jar -Dfile=/p
ath/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=net.sf.json-lib -DartifactId=json-lib -Dversion=2.2.3 -Dpackaging=jar -Dfile=/pat
h/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.apache.struts:ServiceSystem:war:0.0.1-SNAPSHOT
2) net.sf.json-lib:json-lib:jar:2.2.3
----------
1 required artifact is missing.
for artifact:
org.apache.struts:ServiceSystem:war:0.0.1-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
pom.xml中的配置为
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.2.3</version>
</dependency>
这个配置文件写的有问题么?
这个一开始试了 还是不行 展开
2个回答
展开全部
json-lib是需要区分jdk版本的,pom.xml中的配置应加上<classifier>标签,如用jdk15:
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.2.3</version>
<classifier>jdk15</classifier>
</dependency>
总之,以上<classifier>标签是必须的,如果还是Missing,可能是因为网络原因导致下载失败。请查看本地仓库net\sf\json-lib\json-lib\2.2.3目录下是否存在json-lib-2.2.3-jdk15.jar,如果没有,则把这个目录删除,重新运行mvn clean install
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.2.3</version>
<classifier>jdk15</classifier>
</dependency>
总之,以上<classifier>标签是必须的,如果还是Missing,可能是因为网络原因导致下载失败。请查看本地仓库net\sf\json-lib\json-lib\2.2.3目录下是否存在json-lib-2.2.3-jdk15.jar,如果没有,则把这个目录删除,重新运行mvn clean install
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询