繁体   English   中英

Eclipse Maven缺少本地存在的工件

[英]Eclipse maven missing artifact that exists locally

我对使用Maven依赖项有些陌生,并且在使带有Maven的Eclipse查找所需的工件时遇到了一些麻烦。

我在网上跟随了一个教程,并得到了一个有一些Maven依赖项的完美工作项目。 现在,我开始了一个新教程,它具有与教程项目相同的依赖关系,但是Eclipse表示找不到它们。 实际消息的形式为“缺少工件JAR NAME:VERSION ”。

更糟糕的是,我从中下载jar的存储库当前似乎已脱机。 但是无论如何,我认为下载已经拥有的文件并不合理。

我检查了所有需要的罐子,放在我的HOME/.m2/repository/文件夹下。 我尝试使用脱机选项运行Maven / Update Project ,但没有帮助。

我还尝试查找工作项目中的任何文件是否具有指向我的本地存储库文件夹的任何路径,而我找不到任何东西。 在两个项目中, .classpath文件基本相同。

编辑:

这是该项目上mvn compile的输出:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Test 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/eu/excitementproject/core/1.2.0/core-1.2.0.pom
[WARNING] The POM for eu.excitementproject:core:jar:1.2.0 is missing, no dependency information available
Downloading: https://repo.maven.apache.org/maven2/eu/excitementproject/common/1.2.0/common-1.2.0.pom
[WARNING] The POM for eu.excitementproject:common:jar:1.2.0 is missing, no dependency information available
Downloading: https://repo.maven.apache.org/maven2/eu/excitementproject/util/1.2.0/util-1.2.0.pom
[WARNING] The POM for eu.excitementproject:util:jar:1.2.0 is missing, no dependency information available
Downloading: https://repo.maven.apache.org/maven2/eu/excitementproject/core/1.2.0/core-1.2.0.jar
Downloading: https://repo.maven.apache.org/maven2/eu/excitementproject/util/1.2.0/util-1.2.0.jar
Downloading: https://repo.maven.apache.org/maven2/eu/excitementproject/common/1.2.0/common-1.2.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.785 s
[INFO] Finished at: 2015-07-28T23:43:38-03:00
[INFO] Final Memory: 8M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project mvntest: Could not resolve dependencies for project mvntest:mvntest:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: eu.excitementproject:core:jar:1.2.0, eu.excitementproject:common:jar:1.2.0, eu.excitementproject:util:jar:1.2.0: Could not find artifact eu.excitementproject:core:jar:1.2.0 in central (https://repo.maven.apache.org/maven2) -> [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

我不知道所需工件的POM应该是什么。 在另一个项目上运行mvn compile ,我没有返回任何错误,即使有一些共同的依赖性。

在我的本地存储库中...

~/.m2/repository ,我确实具有所需的jar。 例如,文件夹~\\.m2\\repository\\eu\\excitementproject\\core\\1.2.0包含eu.excitementproject:core:jar:1.2.0的jar,并且归档文件中的META-INF\\maven\\eu.excitementproject\\core下有pom.xml。 META-INF\\maven\\eu.excitementproject\\core

您提到的依赖性似乎不在本地存储库或远程存储库中。

我认为,您必须先手动将它们添加到本地存储库中,然后再对项目进行mvn更新

要将私有jar安装在本地存储库中,请使用以下命令,如下所示

mvn install:install-file -Dfile=<PathToJAR>\ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

希望这能解决您的问题。

您的maven存储库也必须包含工件的POM。 这支持maven知道该工件的依赖性。 因此,尝试在工件存储库中创建或生成POM。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM