首页 文章

我如何在maven项目中安装缺失的工件

提问于
浏览
0

运行mvn clean install时出现以下错误

Missing:
----------
1) org.apache.maven.shared:maven-invoker:jar:2.0.6

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=org.apache.maven.shared -DartifactId=maven-invoker -Dversion=2.0.6 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=org.apache.maven.shared -DartifactId=maven-invoker -Dversion=2.0.6 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
    1) org.apache.maven.plugins:maven-archetype-plugin:maven-plugin:2.0-alpha-4
    2) org.apache.maven.shared:maven-invoker:jar:2.0.6

2) org.apache.maven.archetype:archetype-common:jar:2.0-alpha-4

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=org.apache.maven.archetype -DartifactId=archetype-common -Dversion=2.0-alpha-4 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=org.apache.maven.archetype -DartifactId=archetype-common -Dversion=2.0-alpha-4 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
    1) org.apache.maven.plugins:maven-archetype-plugin:maven-plugin:2.0-alpha-4
    2) org.apache.maven.archetype:archetype-common:jar:2.0-alpha-4

----------
2 required artifacts are missing.

for artifact: 
  org.apache.maven.plugins:maven-archetype-plugin:maven-plugin:2.0-alpha-4

from the specified remote repositories:
  nexus (http://nexus.browsermob.com/content/groups/public/)



[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Mar 23 14:16:32 EDT 2011
[INFO] Final Memory: 11M/81M
[INFO] ------------------------------------------------------------------------

3 回答

  • 0

    这些工件在主maven存储库中可用:maven-invoker:2.0.6archetype-common:2.0-alpha-4,它们应自动解析 .

    您的问题是这个Nexus存储库:http://nexus.browsermob.com . 我无权访问它,但必须将其配置为代理maven central repository . 如果您是BrowserMob的员工,请询问负责Nexus服务器的人员 . 如果不是 - 只需从 pom.xmlsettings.xml 全局删除此存储库 . 您有可能成功构建项目 .

  • 1

    看起来您正在使用的存储库(http://nexus.browsermob.com/content/groups/public/)不包含一些常见的maven插件 .

    你有几个选择:

    • 配置nexus.browsermob.com repo,以便它从maven central代理工件

    • 将maven中央存储库添加到本地设置文件中

    如果要转到选项2,请将其添加到设置文件的 <repositories> 部分(通常位于 .m2/settings.xml 的主文件夹中):

    <repository>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <id>central</id>
        <url>http://repo1.maven.org/maven2</url>
    </repository>
    

    这进入 <pluginRepositories> 部分:

    <pluginRepository>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <id>central</id>
        <url>http://repo1.maven.org/maven2</url>
    </pluginRepository>
    
  • 1

    只需将“http://nexus.browsermob.com/content/groups/public/”粘贴到您的Web浏览器中,然后查看其中的库列表 . 你会看到那里的 libraries are absent 或它们是 with different version numbers . (这很有可能 . )

    灵魂是:

    玩得开心 .

相关问题