如何通过maven连接器停止在线搜索?

时间:2017-09-18 20:37:31

标签: java eclipse maven

当我已经通过提供url来覆盖他们拥有本地库而非pom文件的功能时,如何通过maven m2e连接器停止在线搜索依赖关系:

<repository>
    <id>central</id>
    <url>file://${basedir}/library</url>
</repository>

我的所有其他文件从本地存在的库中下载(我的意思是复制),除了一些我没有包含在库中的文件。是否有任何方式连接器也只搜索本地库。我的日志如下所示。

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------
[INFO] Total time: 5.413 s
[INFO] Finished at: 2017-09-18T15:22:36-05:00
[INFO] Final Memory: 12M/125M
[INFO] ------------------------------------------------------------------
------
[ERROR] Failed to execute goal on project myproject: Could not resolve 
dependencies for project com.company.product:myproject:jar:1.0: Failed to 
collect dependencies at org.glassfish.jersey.media:jersey-media-json-
jackson:jar:2.19 -> com.fasterxml.jackson.jaxrs:jackson-jaxrs-
base:jar:2.5.1 -> com.fasterxml.jackson.core:jackson-core:jar:2.5.1: 
Failed to read artifact descriptor for 
com.fasterxml.jackson.core:jackson-core:jar:2.5.1: Could not transfer 
artifact com.fasterxml.jackson.core:jackson-core:pom:2.5.1 from/to 
release.maven.java.net (https://maven.java.net/content/groups/public): 
sun.security.validator.ValidatorException: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to 
find valid certification path to requested target -> [Help 1]
[ERROR] 

这里我以包为目标运行。如果你问我,我可以提供更多细节。

2 个答案:

答案 0 :(得分:0)

很简单,请让您的中央存储库重定向到settings.xml文件中的本地存储库。下面给出的例子。如果需要进一步的帮助,请告诉我。

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  ...
  <mirrors>
    <mirror>
      <id>central-repo</id>
      <name>Local repo</name>
      <url>http://<localhost>/central</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>
  ...
</settings>

答案 1 :(得分:0)

您可以尝试-o选项(离线)。 示例命令行:     mvn clean package -o