当前位置:   article > 正文

maven deploy 400失败,二次上传maven source.jar包_mvn source deploy

mvn source deploy

1、问题

mvn仓库关闭了redeploy, 经常会遇到一些400错误,其中一个原因是一次deploy动作会执行两次sources包的发布。
原因是因为重复定义了maven-source-plugin插件,or 引入 maven-shade-plugin 导致source 执行了两次

2、解决办法

  • 开发去掉自己代码里的maven-source-plugin插件,maven-source-plugin,此时如果自身的pom里也在定义一份source插件,且groupid或者artifactid不一样的情况下maven是无法仲裁掉的。这时候发布maven仓库时source包就会因为upload两遍而导致报400错误。

如何判断顶级自己继承的顶级pom里有没有这个插件,除了直接看顶级pom的内容,还可以用命令: mvn help:effective-pom 看实际生效pom的完整内容。

  • 由于引入 maven-shade-plugin 导致 source 上传两次,解决办法 ,定义一个空的module 解决

由于希望将多个jar 发布到一起,导致当前spi 工程source 执行一次、maven-shade-plugin 又执行了一次?

<packaging>jar</packaging>
    <groupId>xxxxx</groupId>
    <artifactId>xxx-shade</artifactId>
    <version>${revision}</version>
    <dependencies>
        <dependency>
            <groupId>com.xxxx</groupId>
            <artifactId>xxx-spi</artifactId>
        </dependency>
    </dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
                <createDependencyReducedPom>false</createDependencyReducedPom>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <filters>
                            <filter>
                                <artifact>*:*</artifact>
                                <excludes>
                                    <exclude>META-INF/*.SF</exclude>
                                    <exclude>META-INF/*.DSA</exclude>
                                    <exclude>META-INF/*.RSA</exclude>
                                </excludes>
                            </filter>
                        </filters>
                        <createSourcesJar>true</createSourcesJar>
                        <shadeSourcesContent>true</shadeSourcesContent>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/代码探险家/article/detail/837111
推荐阅读
相关标签
  

闽ICP备14008679号