maven部署插件部署文件目标坚持为之前的部署文件执行部署javadoc文件



我有一个pom,用来打包一些第三方jar部署到本地nexus。然而,第二次上传总是失败。它似乎总是在获取与第一次部署文件执行相关联的javadoc,尽管我没有指定这一点。

这是一个bug,还是我做错了什么?

    <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>a.b.c</groupId>
  <artifactId>vendorx_jdbc_driver_wrapper</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>
  <properties>
    <vendorx_jdbc_driver_wrapper.javadoczip>${basedir}/files/11.2.0.1.0/jdbc/javadoc.zip</vendorx_jdbc_driver_wrapper.javadoczip>
    <vendorx_jdbc_driver_wrapper.javadoctemp>${basedir}/files/11.2.0.1.0/jdbc/javadoctemp</vendorx_jdbc_driver_wrapper.javadoctemp>
    <vendorx_jdbc_driver_wrapper.javadocfile>${basedir}/files/11.2.0.1.0/jdbc/javadoctemp/thejavadocs.jar</vendorx_jdbc_driver_wrapper.javadocfile>
  </properties>
  <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.2</version>
            <executions>
                <execution>
                    <id>prepare</id>
                    <phase>validate</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <tasks>
                            <echo message="repackge the vendorx javadoc zip to be in the expected format" />
                            <delete includeemptydirs="true">
                                <fileset dir="${vendorx_jdbc_driver_wrapper.javadoctemp}" includes="**/*" defaultexcludes="false"/>
                             </delete>
                            <unzip src="${vendorx_jdbc_driver_wrapper.javadoczip}" dest="${vendorx_jdbc_driver_wrapper.javadoctemp}" />
                            <!--  N.B. vendorx zip version specific location - you will have to change this to make it work -->
                            <jar destfile="${vendorx_jdbc_driver_wrapper.javadocfile}" basedir="${vendorx_jdbc_driver_wrapper.javadoctemp}/E13995_02/html"/>
                        </tasks>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.3.1</version>
            <executions>
                <execution>
                    <id>install-library-main</id>
                    <phase>install</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <configuration>
                        <file>${basedir}/files/11.2.0.1.0/jdbc/lib/vjdbc99.jar</file>
                        <groupId>a.b.c.com.vendorx</groupId>
                        <artifactId>vjdbc99</artifactId>
                        <version>11.2.0.1.0</version>
                        <packaging>jar</packaging>
                        <generatePom>true</generatePom>
                    </configuration>
                </execution>
                <execution>
                    <id>install-javadocs-main</id>
                    <phase>install</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <configuration>
                        <file>${vendorx_jdbc_driver_wrapper.javadocfile}</file>
                        <groupId>a.b.c.com.vendorx</groupId>
                        <artifactId>vjdbc99</artifactId>
                        <version>11.2.0.1.0</version>
                        <packaging>jar</packaging>
                        <classifier>javadoc</classifier>
                    </configuration>
                </execution>
                <execution>
                    <id>install-library-debug</id>
                    <phase>install</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <configuration>
                        <file>${basedir}/files/11.2.0.1.0/jdbc/lib/vjdbc99_g.jar</file>
                        <groupId>a.b.c.com.vendorx</groupId>
                        <artifactId>vjdbc99_g</artifactId>
                        <version>11.2.0.1.0</version>
                        <packaging>jar</packaging>
                        <generatePom>true</generatePom>
                    </configuration>
                </execution>
                <execution>
                    <id>install-javadocs-debug</id>
                    <phase>install</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <configuration>
                        <!--  same javadocs as for non debug -->
                        <file>${vendorx_jdbc_driver_wrapper.javadocfile}</file>
                        <groupId>a.b.c.com.vendorx</groupId>
                        <artifactId>vjdbc99_g</artifactId>
                        <version>11.2.0.1.0</version>
                        <packaging>jar</packaging>
                        <classifier>javadoc</classifier>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.7</version>
            <executions>
                <!--  Don't bother deploying this POM ... its only the artifact we want to deploy -->
                <execution>
                    <id>default-deploy</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>deploy</goal>
                    </goals>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </execution>
                <!--  This is the real thing we are deploying -->
                <execution>
                    <id>deploy-library-main</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>deploy-file</goal>
                    </goals>
                    <configuration>
                        <file>${basedir}/files/11.2.0.1.0/jdbc/lib/vjdbc99.jar</file>
                        <groupId>a.b.c.com.vendorx</groupId>
                        <artifactId>vjdbc99</artifactId>
                        <version>11.2.0.1.0</version>
                        <packaging>jar</packaging>
                        <generatePom>true</generatePom>
                        <javadoc>${vendorx_jdbc_driver_wrapper.javadocfile}</javadoc>
                        <url>http://foo.lan:8888/nexus/content/repositories/releases</url>
                        <repositoryId>releases</repositoryId>
                    </configuration>
                </execution>
                <execution>
                    <id>deploy-library-debug</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>deploy-file</goal>
                    </goals>
                    <configuration>
                        <file>${basedir}/files/11.2.0.1.0/jdbc/lib/vjdbc99_g.jar</file>
                        <groupId>a.b.c.com.vendorx</groupId>
                        <artifactId>vjdbc99_g</artifactId>
                        <version>11.2.0.1.0</version>
                        <packaging>jar</packaging>
                        <generatePom>true</generatePom>
                        <url>http://foo.lan:8888/nexus/content/repositories/releases</url>
                        <repositoryId>releases</repositoryId>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
  </build>
      <distributionManagement>
        <repository>
          <id>releases</id>
          <url>http://foo.lan:8888/nexus/content/repositories/releases</url>
        </repository>
        <snapshotRepository>
          <id>snapshots</id>
          <url>http://foo.lan:8888/nexus/content/repositories/snapshots</url>
        </snapshotRepository>
      </distributionManagement>

</project>

这是的输出

C:Userswibbleworkspacevendorx_jdbc_driver_wrapper>mvn deploy
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building vendorx_jdbc_driver_wrapper 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.2:run (prepare) @ vendorx_jdbc_driver_wrapper ---
[INFO] Executing tasks
     [echo] repackge the vendorx javadoc zip to be in the expected format
    [unzip] Expanding: C:Userswibbleworkspacevendorx_jdbc_driver_wrapperfiles11.2.0.1.0jdbcjavadoc.zip into C:Userswibbleworkspacevendorx_jdbc_driver_wrapperfiles11.2.0.1.0j
dbcjavadoctemp
      [jar] Building jar: C:Userswibbleworkspacevendorx_jdbc_driver_wrapperfiles11.2.0.1.0jdbcjavadoctempthejavadocs.jar
[INFO] Executed tasks
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ vendorx_jdbc_driver_wrapper ---
[INFO] Installing C:Userswibbleworkspacevendorx_jdbc_driver_wrapperpom.xml to C:Userswibble.m2repositoryukcohisvendorx_jdbc_driver_wrapper.0.1-SNAPSHOTvendorx_jdbc_driver_wr
apper-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (install-library-main) @ vendorx_jdbc_driver_wrapper ---
[INFO] Installing C:Userswibbleworkspacevendorx_jdbc_driver_wrapperfiles11.2.0.1.0jdbclibvjdbc99.jar to C:Userswibble.m2repositoryukcohiscomvendorxvjdbc9911.2.0.1.0ojdbc
6-11.2.0.1.0.jar
[INFO] Installing C:UserswibbleAppDataLocalTemp1mvninstall1181445077198226588.pom to C:Userswibble.m2repositoryukcohiscomvendorxvjdbc9911.2.0.1.0vjdbc99-11.2.0.1.0.pom
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (install-javadocs-main) @ vendorx_jdbc_driver_wrapper ---
[INFO] Installing C:Userswibbleworkspacevendorx_jdbc_driver_wrapperfiles11.2.0.1.0jdbcjavadoctempthejavadocs.jar to C:Userswibble.m2repositoryukcohiscomvendorxvjdbc9911.
2.0.1.0vjdbc99-11.2.0.1.0-javadoc.jar
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (install-library-debug) @ vendorx_jdbc_driver_wrapper ---
[INFO] Installing C:Userswibbleworkspacevendorx_jdbc_driver_wrapperfiles11.2.0.1.0jdbclibvjdbc99_g.jar to C:Userswibble.m2repositoryukcohiscomvendorxvjdbc99_g11.2.0.1.0o
jdbc6_g-11.2.0.1.0.jar
[INFO] Installing C:UserswibbleAppDataLocalTemp1mvninstall4548076073436253537.pom to C:Userswibble.m2repositoryukcohiscomvendorxvjdbc99_g11.2.0.1.0vjdbc99_g-11.2.0.1.0.pom
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (install-javadocs-debug) @ vendorx_jdbc_driver_wrapper ---
[INFO] Installing C:Userswibbleworkspacevendorx_jdbc_driver_wrapperfiles11.2.0.1.0jdbcjavadoctempthejavadocs.jar to C:Userswibble.m2repositoryukcohiscomvendorxvjdbc99_g1
1.2.0.1.0vjdbc99_g-11.2.0.1.0-javadoc.jar
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ vendorx_jdbc_driver_wrapper ---
[INFO] Skipping artifact deployment
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy-file (deploy-library-main) @ vendorx_jdbc_driver_wrapper ---
Uploading: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99/11.2.0.1.0/vjdbc99-11.2.0.1.0.jar
Uploaded: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99/11.2.0.1.0/vjdbc99-11.2.0.1.0.jar (2062 KB at 3152.7 KB/sec)
Uploading: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99/11.2.0.1.0/vjdbc99-11.2.0.1.0.pom
Uploaded: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99/11.2.0.1.0/vjdbc99-11.2.0.1.0.pom (404 B at 8.8 KB/sec)
Downloading: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99/maven-metadata.xml
Uploading: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99/maven-metadata.xml
Uploaded: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99/maven-metadata.xml (316 B at 6.1 KB/sec)
Uploading: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99/11.2.0.1.0/vjdbc99-11.2.0.1.0-javadoc.jar
Uploaded: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99/11.2.0.1.0/vjdbc99-11.2.0.1.0-javadoc.jar (780 KB at 1621.4 KB/sec)
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy-file (deploy-library-debug) @ vendorx_jdbc_driver_wrapper ---
Uploading: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99_g/11.2.0.1.0/vjdbc99_g-11.2.0.1.0.jar
Uploaded: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99_g/11.2.0.1.0/vjdbc99_g-11.2.0.1.0.jar (3323 KB at 2472.1 KB/sec)
Uploading: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99_g/11.2.0.1.0/vjdbc99_g-11.2.0.1.0.pom
Uploaded: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99_g/11.2.0.1.0/vjdbc99_g-11.2.0.1.0.pom (406 B at 6.8 KB/sec)
Downloading: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99_g/maven-metadata.xml
Uploading: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99_g/maven-metadata.xml
Uploaded: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99_g/maven-metadata.xml (318 B at 4.7 KB/sec)
Uploading: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99/11.2.0.1.0/vjdbc99-11.2.0.1.0-javadoc.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.311s
[INFO] Finished at: Mon Jan 23 12:34:09 GMT 2012
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (deploy-library-debug) on project vendorx_jdbc_driver_wrapper: Error deploying attached artifact C:UsersAdm
inistratorworkspacevendorx_jdbc_driver_wrapperfiles11.2.0.1.0jdbcjavadoctempthejavadocs.jar: Failed to deploy artifacts: Could not transfer artifact uk.co.his.com.vendorx:vjdbc99:jar:javadoc:11.2.
0.1.0 from/to releases (http://foo.lan:8888/nexus/content/repositories/releases): Failed to transfer file: http://foo.lan:8888/nexus/content/repositories/releases/a/b/c/com/vendorx/vjdbc99/1
1.2.0.1.0/vjdbc99-11.2.0.1.0-javadoc.jar. Return code is: 400 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
C:Userswibbleworkspacevendorx_jdbc_driver_wrapper>

我在部署插件jira上创建了一个bug:MDEPOLY-143

第三方POM几乎永远不会与您的本地Maven基础设施很好地协同工作。

POM通过将多个目标与阶段install相关联来修改Maven构建生命周期。

要部署该POM定义的工件,我建议您首先通过发出mvn package命令来创建工件。这将在项目的构建文件夹(target/)中创建工件,但不会将它们发送到本地存储库。然后一个接一个地手动上传到您的存储库中

如果您更喜欢直接从POM文件进行部署,请事先准备好进行一些认真的编辑。

附带说明:您可能希望将此类工件放入Nexus内部的第三方存储库,而不是nexus/content/repositories/releases,后者仅为您自己的软件版本保留(按照惯例)。

希望这能有所帮助!

最新更新