我對使用Maven依賴關系有點新,並且在使用Maven查找所需的工件時遇到了一些麻煩。
我在線學習了一個教程,並得到了一些完美的工作項目,其中有一些Maven依賴項。現在我開始了一個新的教程,其中有一些與教程項目相同的依賴項,但Eclipse說它找不到它們。實際的消息采用“Missing artifact JAR NAME:VERSION ”的形式。
更糟糕的是,我從目前下載的罐子庫似乎處於脫機狀態。但無論如何,我不認為下載我已有的文件是合理的。
我檢查了所有需要的罐子在我的 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
我不知道所需文物的聚甲醛應該是什麽。在另一個項目上運行 mvn compile
我沒有返回任何錯誤,即使有一些共同的依賴關系。
在我的本地存儲庫中...
Under ~/.m2/repository
, I do have the required
jars. For example, the folder
~\.m2\repository\eu\excitementproject\core\1.2.0
contains the jar for eu.excitementproject:core:jar:1.2.0, and
inside the archive there is a pom.xml under
META-INF\maven\eu.excitementproject\core