java - 如何设置maven 3本地插件仓库

标签 java maven build-automation maven-3

由于某些限制,我需要一个完全离线的 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>

最佳答案

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

更多详细信息,请参见以下链接:

关于java - 如何设置maven 3本地插件仓库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13498186/

相关文章:

java - 在 Java 运行时从数组中删除元素

java - 如何在windows下更改Maven的M2_REPO

JavaMail : msg. setSubject() 在版本 1.4.7 中不接受第二个参数(编码),抛出编译时错误

java - QueryDsl 错误。未生成 Q 类

java - 检查 Swing 表单是否不包含空字段

java - 列表不同数据类型之间的转换

java - 使用 CertPathValidator 进行签名验证,包括 CRL 撤销

delphi - Delphi中如何自动设置版本信息?

tfs - 我可以让 TFS 在不同的服务器上部署和执行测试吗?

command-line - 哪种与 SourceSafe 交互的方式更快?命令行还是对象模型?