【发布时间】:2016-12-02 04:36:47
【问题描述】:
我构建了公共项目并将其安装到本地存储库,然后我尝试使用相同的jar包但计算机找不到它。
首先,我将 common 构建并安装到我的本地存储库中:
F:\seprate\paymate-commons>mvn -DskipTests install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building paymate-commons 2.6.9
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ paymate-commons ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory F:\seprate\paymate-commons\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ paymate-commons ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ paymate-commons ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ paymate-commons ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ paymate-commons ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ paymate-commons ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ paymate-commons ---
[INFO] Installing F:\seprate\paymate-commons\target\paymate-commons-2.6.9.jar to C:\Users\Lu Sheng\.m2\repository\au\com\paymate\paymate-commons\2.6.9\paymate-commons-2.6.9.jar
[INFO] Installing F:\seprate\paymate-commons\pom.xml to C:\Users\Lu Sheng\.m2\repository\au\com\paymate\paymate-commons\2.6.9\paymate-commons-2.6.9.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.841 s
[INFO] Finished at: 2016-07-28T10:18:01+10:00
[INFO] Final Memory: 11M/155M
[INFO] ------------------------------------------------------------------------
之后我尝试构建取决于 paymate-commons 的 paymate-model
F:\seprate\paymate-model>mvn -o -DskipTests install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building paymate-model 2.6.9
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.944 s
[INFO] Finished at: 2016-07-28T10:21:22+10:00
[INFO] Final Memory: 7M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project paymate-model: Could not resolve dependencies for project au.com.paymate:paymate-model:jar:2.6.9: Failed to collect dependencies at au.com.paymate:paymate-commons:jar:2.6.9: Failed to read artifact descriptor for au.com.paymate:paymate-commons:jar:2.6.9: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact au.com.paymate:projects:pom:2.6.9 has not been downloaded from it before. -> [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 -DskipTests install 或 mvn -DskipTests install 我不使用本地存储库 但是我可以在默认的本地存储库中找到 jar 文件。
C:\Users\Username\.m2\repository\au\com\paymate\paymate-commons\2.6.9
如何让电脑知道jar的位置并使用它?我需要在 pom.xml 上做一些设置吗?
【问题讨论】:
-
您能否提供有关您正在使用的 pom.xml 的更多详细信息?在最后一条错误消息中显示“...工件 au.com.paymate:*projects*:pom:2.6.9 尚未下载...”这与您的工件不同以前安装过。
-
我不明白这个:我找不到我使用 mvn -DskipTests install 或 mvn -DskipTests install 我不知道使用本地存储库但我可以在默认本地存储库中找到 jar 文件。
标签: java maven repository pom.xml local