安装maven时无法找到工件

时间:2018-01-15 08:37:54

标签: java spring maven tomcat dependencies

当我为一个项目安装maven时,在bitbucket网站和配置服务器tomcat中克隆了然后我有错误。

    [INFO] --- maven-dependency-plugin:2.10:copy (default) @ authconfig 
    [INFO] Configured Artifact: ch.smartlink:authconfig:0.0.1-SNAPSHOT:jar
    Downloading: http://central.maven.org/maven2/ [...private link]
    Downloading: http://central.maven.org/maven2/ [...private link]
   [INFO] BUILD FAILURE
   [ERROR] Failed to execute goal org.apache.maven.plugins:maven-
   dependency-plugin:2.10:copy (default) on project authconfig: Unable to 
   find artifact. Could not find artifact 
   ch.smartlink:authconfig:jar:0.0.1-SNAPSHOT in nexus 
   (http://central.maven.org/maven2/)
   [ERROR] Try downloading the file manually from the project website.
   [ERROR] Then, install it using the command:
   [ERROR] mvn install:install-file -DgroupId=ch.smartlink -
   DartifactId=authconfig -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar -
   Dfile=/path/to/file
   [ERROR] Alternatively, if you host your own repository you can deploy 
   the file there:
   [ERROR] mvn deploy:deploy-file -DgroupId=... -DartifactId=authconfig -
   Dversion=0.0.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=
   [url] -DrepositoryId=[id]
   [ERROR] ...:authconfig:jar:0.0.1-SNAPSHOT
   [ERROR] from the specified remote repositories:
   [ERROR] nexus (http://central.maven.org/maven2/, releases=true, 
  snapshots=true)

如何解决?

1 个答案:

答案 0 :(得分:1)

如错误消息所述,maven无法在官方maven存储库中找到工件。 您需要使用" mvn install:install-file"将其安装在本地存储库(〜/ .m2 / repository)中。或者,更好的是,告诉maven在pom文件中添加存储库标记的位置。

请参阅:https://maven.apache.org/guides/introduction/introduction-to-repositories.html