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

如何在maven项目中安装缺少的工件,maven,Maven,在运行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.a

在运行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] ------------------------------------------------------------------------ 缺失: ---------- 1) org.apache.maven.shared:maven调用程序:jar:2.0.6 尝试从项目网站手动下载该文件。 然后,使用以下命令安装: mvn安装:安装文件-DgroupId=org.apache.maven.shared-DartifactId=maven invoker-Dversion=2.0.6-dpackage=jar-Dfile=/path/to/file 或者,如果您拥有自己的存储库,则可以在其中部署文件: mvn部署:部署文件-DgroupId=org.apache.maven.shared-DartifactId=maven invoker-Dversion=2.0.6-dpackage=jar-Dfile=/path/to/file-Durl=[url]-DrepositoryId=[id] 依赖项的路径: 1) 插件:maven原型插件:maven插件:2.0-alpha-4 2) org.apache.maven.shared:maven调用程序:jar:2.0.6 2) 原型:原型通用:jar:2.0-alpha-4 尝试从项目网站手动下载该文件。 然后,使用以下命令安装: mvn安装:安装文件-DgroupId=org.apache.maven.archetype-DartifactId=archetype common-Dversion=2.0-alpha-4-dpackage=jar-Dfile=/path/to/file 或者,如果您拥有自己的存储库,则可以在其中部署文件: mvn部署:部署文件-DgroupId=org.apache.maven.archetype-DartifactId=archetype common-Dversion=2.0-alpha-4-dpackage=jar-Dfile=/path/to/file-Durl=[url]-DrepositoryId=[id] 依赖项的路径: 1) 插件:maven原型插件:maven插件:2.0-alpha-4 2) 原型:原型通用:jar:2.0-alpha-4 ---------- 缺少2个必需的工件。 对于工件: 插件:maven原型插件:maven插件:2.0-alpha-4 从指定的远程存储库: 关系(http://nexus.browsermob.com/content/groups/public/) [信息]------------------------------------------------------------------------ [信息]有关更多信息,请使用-e开关运行Maven [信息]------------------------------------------------------------------------ [信息]总时间:2秒 [信息]完成时间:2011年3月23日星期三14:16:32美国东部夏令时 [信息]最终内存:11M/81M [信息]------------------------------------------------------------------------
这些工件在主maven存储库中可用:它们应该自动解析


您的问题是此Nexus存储库:。我没有访问权限,但必须将其配置为代理maven。如果您是BrowserMob的员工,请咨询Nexus server的负责人。如果没有-只需从
pom.xml
settings.xml
全局删除此存储库即可。您有可能成功地构建项目。

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

您有两个选择:

  • 配置nexus.browsermob.com repo,以便它代理来自maven central的工件
  • 将maven中央存储库添加到本地设置文件中
  • 如果要选择选项2,请将其添加到设置文件的
    部分(通常位于
    .m2/settings.xml
    的主文件夹中):

    
    真的
    真的
    中心的
    http://repo1.maven.org/maven2
    
    并将其放入
    部分:

    <pluginRepository>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <id>central</id>
        <url>http://repo1.maven.org/maven2</url>
    </pluginRepository>
    
    
    真的
    真的
    中心的
    http://repo1.maven.org/maven2
    
    只需将“”粘贴到您的web浏览器中,即可查看那里的库列表。您将看到,库不存在,或者它们是具有不同版本号的(这是很有可能的)

    SOUTION是:

    • 如果版本号不同,则更新pom.xml中与上的版本号相关的版本号
    • 如果没有,请联系服务器人员,将该jar添加到存储库中
    玩得开心

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