maven-deploy-plugin deploy-file目标坚持为先前的部署文件执行部署javadoc文件

时间:2012-01-23 13:39:13

标签: maven javadoc

我有一个pom用于打包一些第三方罐子以部署到本地连接。 然而,第二次上传总是失败。好像它总是拿起与第一个部署文件执行相关联的javadoc,尽管我还没有指定它。

这是一个错误,或者我做错了什么?

    <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:\Users\wibble\workspace\vendorx_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:\Users\wibble\workspace\vendorx_jdbc_driver_wrapper\files\11.2.0.1.0\jdbc\javadoc.zip into C:\Users\wibble\workspace\vendorx_jdbc_driver_wrapper\files\11.2.0.1.0\j
dbc\javadoctemp
      [jar] Building jar: C:\Users\wibble\workspace\vendorx_jdbc_driver_wrapper\files\11.2.0.1.0\jdbc\javadoctemp\thejavadocs.jar
[INFO] Executed tasks
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ vendorx_jdbc_driver_wrapper ---
[INFO] Installing C:\Users\wibble\workspace\vendorx_jdbc_driver_wrapper\pom.xml to C:\Users\wibble\.m2\repository\uk\co\his\vendorx_jdbc_driver_wrapper\0.0.1-SNAPSHOT\vendorx_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:\Users\wibble\workspace\vendorx_jdbc_driver_wrapper\files\11.2.0.1.0\jdbc\lib\vjdbc99.jar to C:\Users\wibble\.m2\repository\uk\co\his\com\vendorx\vjdbc99\11.2.0.1.0\ojdbc
6-11.2.0.1.0.jar
[INFO] Installing C:\Users\wibble\AppData\Local\Temp\1\mvninstall1181445077198226588.pom to C:\Users\wibble\.m2\repository\uk\co\his\com\vendorx\vjdbc99\11.2.0.1.0\vjdbc99-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:\Users\wibble\workspace\vendorx_jdbc_driver_wrapper\files\11.2.0.1.0\jdbc\javadoctemp\thejavadocs.jar to C:\Users\wibble\.m2\repository\uk\co\his\com\vendorx\vjdbc99\11.
2.0.1.0\vjdbc99-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:\Users\wibble\workspace\vendorx_jdbc_driver_wrapper\files\11.2.0.1.0\jdbc\lib\vjdbc99_g.jar to C:\Users\wibble\.m2\repository\uk\co\his\com\vendorx\vjdbc99_g\11.2.0.1.0\o
jdbc6_g-11.2.0.1.0.jar
[INFO] Installing C:\Users\wibble\AppData\Local\Temp\1\mvninstall4548076073436253537.pom to C:\Users\wibble\.m2\repository\uk\co\his\com\vendorx\vjdbc99_g\11.2.0.1.0\vjdbc99_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:\Users\wibble\workspace\vendorx_jdbc_driver_wrapper\files\11.2.0.1.0\jdbc\javadoctemp\thejavadocs.jar to C:\Users\wibble\.m2\repository\uk\co\his\com\vendorx\vjdbc99_g\1
1.2.0.1.0\vjdbc99_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:\Users\Adm
inistrator\workspace\vendorx_jdbc_driver_wrapper\files\11.2.0.1.0\jdbc\javadoctemp\thejavadocs.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:\Users\wibble\workspace\vendorx_jdbc_driver_wrapper>

我在部署插件jira上创建了一个错误: MDEPLOY-143

1 个答案:

答案 0 :(得分:1)

第三方POM几乎不会与您当地的Maven基础设施很好地结合在一起。

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

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

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

作为旁注:您可能希望将此类工件放入Nexus内的第三方存储库,而不是nexus/content/repositories/releases,这仅为您自己的软件版本保留(按惯例)。

希望这有帮助!