【问题标题】:Install Maven plugin as a dependency?安装 Maven 插件作为依赖项?
【发布时间】:2014-07-29 15:55:17
【问题描述】:

我正在尝试将特定插件(maven-dependency-plugin)下载到特定的本地存储库。

我可以像添加任何其他工件一样将该插件作为依赖项添加然后运行 ​​mvn install 吗?

我问的原因是我一直在尝试上述方法,但每当涉及到该插件的依赖项时,它都无法从 maven Central 获取它们,而且它基本上无法正常工作:(

我的 pom:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.stuff</groupId>
    <artifactId>thestuff</artifactId>
    <version>0.0.1</version>
    <packaging>war</packaging>

    <dependencies>
        <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.1</version>
    </dependency>
    </dependencies>

</project>

错误(嗯,前几个):

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2:single (make-zip-assembly) on project stuff: Failed to create assembly: Unable to resolve dependencies for assembly 'zip': Failed to resolve dependencies for assembly: Missing:
[ERROR] ----------
[ERROR] 1) org.apache.maven:maven-plugin-api:jar:2.0.9
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven -DartifactId=maven-plugin-api -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven -DartifactId=maven-plugin-api -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....:pom:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.apache.maven:maven-plugin-api:jar:2.0.9
[ERROR] 
[ERROR] 2) org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.codehaus.plexus -DartifactId=plexus-container-default -Dversion=1.0-alpha-9-stable-1 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.codehaus.plexus -DartifactId=plexus-container-default -Dversion=1.0-alpha-9-stable-1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....:pom:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
[ERROR] 
[ERROR] 3) org.apache.maven:maven-profile:jar:2.0.9
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven -DartifactId=maven-profile -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven -DartifactId=maven-profile -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....:pom:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.apache.maven:maven-project:jar:2.0.9
[ERROR] 4) org.apache.maven:maven-profile:jar:2.0.9
[ERROR] 
[ERROR] 4) org.apache.maven:maven-artifact-manager:jar:2.0.9
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven -DartifactId=maven-artifact-manager -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven -DartifactId=maven-artifact-manager -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....:pom:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.apache.maven:maven-project:jar:2.0.9
[ERROR] 4) org.apache.maven:maven-artifact-manager:jar:2.0.9
[ERROR] 
[ERROR] 5) org.apache.maven:maven-repository-metadata:jar:2.0.9
[JENKINS] Archiving /root/.jenkins/jobs/yes - NIGHTLY/workspace/com/tsx/yes/core/brms_adapter/pom.xml to stuff.pom
[JENKINS] Archiving /opt/tsx/ESB_container/deploy/stuff.kar to stuff.kar
/opt/tsx/ESB_container/deploy/stuff.kar is not inside /root/.jenkins/jobs/yes - NIGHTLY/workspace/stuff/; will archive in a separate pass
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven -DartifactId=maven-repository-metadata -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven -DartifactId=maven-repository-metadata -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....:pom:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.apache.maven:maven-core:jar:2.0.9
[ERROR] 4) org.apache.maven:maven-repository-metadata:jar:2.0.9
[ERROR] 
[ERROR] 6) org.apache.maven:maven-plugin-registry:jar:2.0.9
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven -DartifactId=maven-plugin-registry -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven -DartifactId=maven-plugin-registry -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....:pom:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.apache.maven:maven-project:jar:2.0.9
[ERROR] 4) org.apache.maven:maven-plugin-registry:jar:2.0.9
[ERROR] 
[ERROR] 7) org.apache.maven:maven-core:jar:2.0.9
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven -DartifactId=maven-core -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven -DartifactId=maven-core -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....p:pom:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.apache.maven:maven-core:jar:2.0.9
[ERROR] 
[ERROR] 8) org.apache.maven.wagon:wagon-file:jar:1.0-beta-2
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.wagon -DartifactId=wagon-file -Dversion=1.0-beta-2 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.wagon -DartifactId=wagon-file -Dversion=1.0-beta-2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....:pom:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.apache.maven:maven-core:jar:2.0.9
[ERROR] 4) org.apache.maven.wagon:wagon-file:jar:1.0-beta-2
[ERROR] 
[ERROR] 9) org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven -DartifactId=maven-plugin-parameter-documenter -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven -DartifactId=maven-plugin-parameter-documenter -Dversion=2.0.9 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....:pom:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.apache.maven:maven-core:jar:2.0.9
[ERROR] 4) org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9
[ERROR] 
[ERROR] 10) org.apache.maven.wagon:wagon-webdav:jar:1.0-beta-2
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.wagon -DartifactId=wagon-webdav -Dversion=1.0-beta-2 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.wagon -DartifactId=wagon-webdav -Dversion=1.0-beta-2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....p:pom:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.apache.maven:maven-core:jar:2.0.9
[ERROR] 4) org.apache.maven.wagon:wagon-webdav:jar:1.0-beta-2
[ERROR] 
[ERROR] 11) slide:slide-webdavlib:jar:2.1
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=slide -DartifactId=slide-webdavlib -Dversion=2.1 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=slide -DartifactId=slide-webdavlib -Dversion=2.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....:pom:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.apache.maven:maven-core:jar:2.0.9
[ERROR] 4) org.apache.maven.wagon:wagon-webdav:jar:1.0-beta-2
[ERROR] 5) slide:slide-webdavlib:jar:2.1
[ERROR] 
[ERROR] 12) de.zeigermann.xml:xml-im-exporter:jar:1.1
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=de.zeigermann.xml -DartifactId=xml-im-exporter -Dversion=1.1 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=de.zeigermann.xml -DartifactId=xml-im-exporter -Dversion=1.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.apache.maven:maven-core:jar:2.0.9
[ERROR] 4) org.apache.maven.wagon:wagon-webdav:jar:1.0-beta-2
[ERROR] 5) slide:slide-webdavlib:jar:2.1
[ERROR] 6) de.zeigermann.xml:xml-im-exporter:jar:1.1
[ERROR] 
[ERROR] 13) org.apache.maven.wagon:wagon-http-lightweight:jar:1.0-beta-2
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.wagon -DartifactId=wagon-http-lightweight -Dversion=1.0-beta-2 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[JENKINS] Archiving /root/.jenkins/jobs/yes - NIGHTLY/workspace/stuff/pom.xml to stuff.pom
[JENKINS] Archiving /root/.jenkins/jobs/yes - NIGHTLY/workspace/yes/target/stuff.jar to stuff/UDMS/0.0.1-20140606.120021-863/UDMS-0.0.1-20140606.120021-863.jar
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.wagon -DartifactId=wagon-http-lightweight -Dversion=1.0-beta-2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) stuff....:pom:1.0.1
[ERROR] 2) org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
[ERROR] 3) org.apache.maven:maven-core:jar:2.0.9
[ERROR] 4) org.apache.maven.wagon:wagon-http-lightweight:jar:1.0-beta-2
[ERROR] 
[JENKINS] Archiving /root/.jenkins/jobs/yes Core - NIGHTLY/workspace/yess/pom.xml to yes.pom
[ERROR] 14) org.apache.maven.wagon:wagon-http-shared:jar:1.0-beta-2
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.wagon -DartifactId=wagon-http-shared -Dversion=1.0-beta-2 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 

【问题讨论】:

  • 当我浏览 maven central 时,插件所依赖的版本似乎不存在...
  • 请显示您收到的错误消息以及您的 pom 文件的外观?
  • 目前的错误是超时错误...和之前不同。我将首先尝试获取旧错误,因为我认为一个更相关
  • 只是一个问题,你为什么使用这么旧的插件版本?您使用哪个 Maven 版本?
  • 我自己指定的唯一插件版本是 maven-dependency-plugin 的版本,只是因为我猜是 maven 网站上的那个:maven.apache.org/plugins/maven-dependency-plugin/examples/…

标签: maven plugins dependencies


【解决方案1】:

插件的定义如下所示:

<project>
    ...
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.4</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    ...
</project>

依赖项定义了您的项目的依赖项,不是 Maven 或其插件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-09-23
    • 1970-01-01
    • 1970-01-01
    • 2017-04-21
    • 2022-08-11
    • 1970-01-01
    • 1970-01-01
    • 2020-12-22
    相关资源
    最近更新 更多