maven 发布部署两次并失败

maven release deploy twice and fail

您好,我只有一个项目有问题,发布失败,Return 代码为:400,ReasonPhrase:请求错误。 在日志中,我看到它想第二次部署相同的工件。 在我将 maven 更新到 3.3.3 之前它一直在工作 maven-source-plugin - 2.4 这是我的 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> <parent> <artifactId>maven-depmgt-pom</artifactId> <groupId>my.parent</groupId> <version>4.0.0-beta-11-SNAPSHOT</version> </parent> <groupId>my.groupId</groupId> <artifactId>my.artid</artifactId> <version>4.0.0-beta-11-SNAPSHOT</version> <packaging>pom</packaging> <name>Che Terminal</name> <scm> <connection>scm:git:git@github.com:myorg/myproj.git</connection> <developerConnection>scm:git:git@github.com:myorg/myproj.git</developerConnection> <tag>HEAD</tag> <url>https://github.com/myorg/myproj</url> </scm> <properties> <project.go.build.dir>${project.build.directory}/go</project.go.build.dir> <project.zip.dir>${project.build.directory}/dir/terminal</project.zip.dir> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> <configuration> <appendAssemblyId>false</appendAssemblyId> <updateOnly>false</updateOnly> <descriptor>${project.basedir}/src/assembly/assembly.xml</descriptor> </configuration> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <executions> <execution> <id>copy-resources</id> <phase>process-resources</phase> <goals> <goal>run</goal> </goals> <configuration> <target> <copy file="index.html" todir="${project.zip.dir}" /> <copy file="term.js" todir="${project.zip.dir}" /> <copy file="server.go" todir="${project.go.build.dir}" /> </target> </configuration> </execution> <execution> <id>copy-terminal-bin</id> <phase>process-classes</phase> <goals> <goal>run</goal> </goals> <configuration> <target> <copy file="${project.go.build.dir}/terminal" todir="${project.zip.dir}" /> <chmod file="${project.zip.dir}/terminal" perm="+x" /> </target> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <executions> <execution> <id>compile-websocket</id> <phase>compile</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>go</executable> <workingDirectory>${project.go.build.dir}</workingDirectory> <arguments> <argument>get</argument> <argument>github.com/myorg/myprj</argument> </arguments> </configuration> </execution> <execution> <id>compile-pty</id> <phase>compile</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>go</executable> <workingDirectory>${project.go.build.dir}</workingDirectory> <arguments> <argument>get</argument> <argument>github.com/myorg/pty</argument> </arguments> </configuration> </execution> <execution> <id>compile-server</id> <phase>compile</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>go</executable> <workingDirectory>${project.go.build.dir}</workingDirectory> <arguments> <argument>build</argument> <argument>-o</argument> <argument>terminal</argument> </arguments> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>

您的问题可能是 maven-assembly-plugin 配置不正确。 有效的 pom 展示

  <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.5.3</version>
    <executions>
      <execution>
        <id>make-assembly</id>
        <phase>package</phase>
        <goals>
          <goal>single</goal>
        </goals>
        <configuration>
          <appendAssemblyId>false</appendAssemblyId>
          <updateOnly>false</updateOnly>
          <descriptor>/Users/sj/dev/src/codenvy/che-websocket-terminal/src/assembly/assembly.xml</descriptor>
          <tarLongFileMode>gnu</tarLongFileMode>
          <useJvmChmod>true</useJvmChmod>
          <recompressZippedFiles>false</recompressZippedFiles>
        </configuration>
      </execution>
    </executions>
    <configuration>
      <appendAssemblyId>false</appendAssemblyId>
      <updateOnly>false</updateOnly>
      <descriptor>/Users/sj/dev/src/codenvy/che-websocket-terminal/src/assembly/assembly.xml</descriptor>
      <tarLongFileMode>gnu</tarLongFileMode>
      <useJvmChmod>true</useJvmChmod>
      <recompressZippedFiles>false</recompressZippedFiles>
    </configuration>
  </plugin>

我假设这意味着工件生成了两次。

正确的配置应该是:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <appendAssemblyId>false</appendAssemblyId>
                        <updateOnly>false</updateOnly>
                        <descriptor>${project.basedir}/src/assembly/assembly.xml</descriptor>
                    </configuration>
                </execution>
            </executions>
        </plugin>