【问题标题】:How to set up maven 3 local plugin repository如何设置 maven 3 本地插件存储库
【发布时间】:2012-11-09 23:52:36
【问题描述】:

由于一些限制,我需要一个完全离线的 maven 存储库。根据 http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException ,仅搜索 <pluginRepositories> 的插件。所以我想知道如何配置 maven 在本地文件系统中查找插件。我尝试在设置<url> 时使用“file://”前缀,但它不起作用。

DEBUG] Verifying availability of /home/dsun/.m2/repository/org/apache/karaf/tooling/features-maven-plugin/2.3.0/features-maven-plugin-2.3.0.jar from [central (http://repo1.maven.org/maven2, releases=true, snapshots=false, managed=false)]
[ERROR] Plugin org.apache.karaf.tooling:features-maven-plugin:2.3.0 or one of its dependencies could not be resolved: The repository system is offline but the artifact org.apache.karaf.tooling:features-maven-plugin:jar:2.3.0 is not available in the local repository. -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.karaf.tooling:features-maven-plugin:2.3.0 or one of its dependencies could not be resolved: The repository system is offline but the artifact org.apache.karaf.tooling:features-maven-plugin:jar:2.3.0 is not available in the local repository.

dsun@localhost:> ls /home/dsun/.m2/repository/org/apache/karaf/tooling/features-maven-plugin/2.3.0/features-maven-plugin-2.3.0.jar
/home/dsun/.m2/repository/org/apache/karaf/tooling/features-maven-plugin/2.3.0/features-maven-plugin-2.3.0.jar

settings.xml

<settings>      
<offline>true</offline>
  <profiles>
  <profile>
    <id>local</id>
    <pluginRepositories>
      <pluginRepository>
      <id>central</id>
      <url>file://${env.HOME}/.m2/repository</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>
   </profile>
 </profiles>
<activeProfiles>
  <activeProfile>local</activeProfile>
</activeProfiles>

<localRepository>${env.HOME}/.m2/repository</localRepository>

【问题讨论】:

  • 我不确定,但也许这篇文章会对你有所帮助:stackoverflow.com/questions/5141211/…
  • 您的配置无法正常工作,因为您将源存储库定义为与目标存储库 (.m2/repository) 相同。您需要有一个初始引导带从哪里开始,并且在所有构建都工作之后,您可以进行设置。
  • 嗨khmarbaise,你能详细解释一下吗?你是什​​么意思“源存储库”?所需的插件已经在我的本地存储库中。我试图删除 settings.xml 中除了 之外的所有行,它也不起作用。

标签: java maven build-automation maven-3


【解决方案1】:

终于找到了问题所在,插件目录下有个叫_maven.repositories的文件,我删除后,一切正常!

更多详情,请看以下链接:

【讨论】:

  • 我没有删除它,而是将它的重要行更改为artifact-name-1.2.pom&gt;= 之类的东西(只是&gt;=,仅此而已)。这对我有用。
【解决方案2】:

自 Maven 3.1-alpha-1 以来, 命令行选项-llr/--legacy-local-repository 或系统属性-Dmaven.legacyLocalRepo=true 应该有帮助

有关使用 maven 离线工作的一般答案,请参阅 here

【讨论】:

  • 在本地存储库(文件系统)中查找 Maven 插件的好技巧;)
【解决方案3】:

这个问题让我非常恼火,以至于我修补了 war 插件以具有 disableOverlaying 参数。你可以在这里找到它 - 从原始版本中分叉出来:https://github.com/crowdcode-de/maven-war-plugin

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-20
    • 1970-01-01
    • 1970-01-01
    • 2014-12-22
    • 1970-01-01
    相关资源
    最近更新 更多