家释放的插件失败:来源的文物得到部署了两次
-
27-09-2019 - |
题
我们使用的是专家释放的插件对哈德森和试图自动释放过程。释放:准备工作正常。当我们试图做的发布:执行时,它失败,因为它试图上传来源的神器两次的储存库。
事情,我试过了,
- 删除的档案,其中不包括家来源插件从超级pom(没有工作)
- 指定目标在哈德森发布-P!附源释放:准备发布:执行。我想将排除源插件从得到执行。(没有工作)。
- 试图指定的插件阶段的某些不存在的阶段在超pom。(没有工作)
- 试图指定的插件的配置,forReleaseProfile作假。(猜测是什么?没有工作过)
它仍然吐出这种错误。
[INFO] [DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[INFO] [DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[INFO] [DEBUG] Checking for pre-existing User-Agent configuration.
[INFO] [DEBUG] Adding User-Agent configuration.
[INFO] [DEBUG] not adding permissions to wagon connection
[INFO] Uploading: http://xx.xx.xx.xx:8081/nexus/content/repositories/releases//com/yyy/xxx/hhh/hhh-hhh/1.9.40/hhh-hhh-1.9.40-sources.jar
[INFO] 57K uploaded (xxx-xxx-1.9.40-sources.jar)
[INFO] [DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[INFO] [DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[INFO] [DEBUG] Checking for pre-existing User-Agent configuration.
[INFO] [DEBUG] Adding User-Agent configuration.
[INFO] [DEBUG] not adding permissions to wagon connection
[INFO] Uploading: http://xx.xxx.xx.xx:8081/nexus/content/repositories/releases//com/xxx/xxxx/xxx/xxx-xxx/1.9.40/xxx-xxx-1.9.40-sources.jar
[INFO] [DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] BUILD ERROR
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Error deploying artifact: Authorization failed: Access denied to: http://xx.xxx.xx.xx:8081/nexus/content/repositories/releases/com/xxx/xxx/xxx/xxx-config/1.9.40/xxx-xxx-1.9.40-sources.jar
任何帮助关于这将是真正的赞赏。
解决方案
试试运行 mvn -Prelease-profile help:effective-pom
.你会发现你有两个执行部分 maven-source-plugin
输出的东西,像这样:
<plugin> <artifactId>maven-source-plugin</artifactId> <version>2.0.4</version> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> <execution> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin>
要解决这个问题,找到处都有用 maven-source-plugin
和确保使用的"id"附加资源,所以,它是同样作为释放曲线。然后将这些部分将会被合并。
最佳做法说得到一致性需要配置,这在根POM的项目在建立>pluginManagement和 不 在你的孩子舞.在儿童pom你只指定在建立>插件,你想要使用专家源插件,但你没有提供任何处决。
在房间里pom.xml:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<!-- This id must match the -Prelease-profile id value or else sources will be "uploaded" twice, which causes Nexus to fail -->
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
在孩子pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
其他提示
我知道这个问题是旧的,但是谷歌打#1所以今天我会加入我的答案适用最新版本的家3.
症状是,来源和如果是的话,为什么不试罐子里部署了两次这样做时释放的生成与某些版本的家3.如果您使用的是专家部署文物的一个Sonatype关系储存库,仅允许工件释放被上载后(这是完全合理的行为),构建失败时,第二次上传的尝试被拒绝。哎呀!
玛文版本3.2.3通过3.3.9有错误-看看 https://issues.apache.org/jira/browse/MNG-5868 和 https://issues.apache.org/jira/browse/MNG-5939.这些版本的产生和部署来源和如果是的话,为什么不试罐子的两倍,这样做时释放。
如果我读了家问题跟踪正确,那些错误是没有计划为解决这个写作(被烧毁的3.4.0释放可能影响到这些).
而不是一个复杂的调整到我pom,我的简单的解决办法是秋天回到家版本3.2.1.
只是打击同样的问题,我分析了这一点。 mvn release:perform
评估释放。性文件,然后检查了标签的一个临时目录和调用有喜欢的东西
/usr/bin/mvn -D maven.repo.local=... -s /tmp/release-settings5747060794.xml
-D performRelease=true -P set-envs,maven,set-envs deploy
我试图再现这样的–手动检查了标签产生的 release:prepare
和援引这一点:
mvn -D performRelease=true -P set-envs,maven,set-envs deploy
我得到了同样的结果:它是想上传的sources.jar 两次。
注意到 qualidafial 在一个意见,设置 performRelease=false
而不是省略了两个附件的相同文件。
我真的没有一个主意如何 部署插件 (或者任何其他插件)使用该财产。
我们可以提供这种参数作为构成的行家-释放-插件:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
</configuration>
</plugin>
</plugins>
</build>
我现在加入 <useReleaseProfile>false</useReleaseProfile>
线的所有舞,并且它看起来像解除现在的工作没有一个错误信息。
我已经struggeling这一问题的一段时间,终于能够解决它们的基础设施。答案在这里,不帮助我,因为我们没有多处决的源插件的目标和配置似乎现给我们。
什么我们错过的是结合执行源插到一个阶段。延伸,例如通过裴,包括行 < 相>安装< /阶段> 在执行解决的问题,我们:
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.0.4</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>install</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
我怀疑的解决办法在于这个答案 在这里, ;不同的插件似乎可以调用的罐子的目标/附加的资源执行。通过结合我们执行某个阶段,我们强迫我们的插件只是运行在这一阶段。
这是发生在我身上时运行
mvn install deploy
我避免的问题,而不是运行
mvn deploy
(这意味着安装).在我的情况下,只有一个神器是被试图将被上载的两倍,这就是一次神器(家-罐子-插件被安装建立一个辅助罐子里除了一个由默认罐执行)。
我不想轻生是在释放插件,我认为你已经得到了 xxx-sources.jar
附加两倍-这就是为什么重复上传。为什么是有重复的附件很难没有看到POM。试试运行 mvn -X
和检查的日志为重视谁 xxx-source.jar
另一个时间。
在任何情况下,一个良好的解决办法的关系将具有临时储存库在这里你可以上载释放几次,当一切都准备好了你刚刚关闭/促进临时回购。检查 Sonatype开放源码软件的安装 对于一个例子。
我有同样的问题。基本上,错误信息被发出时,一个文物发送到联系的两倍。这可能是两次相同的关系储存库,甚至在不同的储存库内的同样的联系。
然而,因为这样的错误配置可能有所不同。在我的情况下,项目都正确地上载在a会为了寻求简便清理,部署建立一步Jenkins,但后来失败的第二个部署已经尝试。这第二次部署已经配置在Jenkins后建立的步骤"发布文物专家库的".
家插在父母和孩子绒球不应有的执行。按标准公约》定义的所有插件与执行/具体目标,在父母双在插件管理部分。儿童pom不应该重新确定上述资料,但仅提及的插件(与工件和版本),需要加以执行。
我有类似的问题与专家组件与父pom如下:
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
和孩子pom了专家组件如下:
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<finalName>xyz</finalName>
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>xyz-distribution</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
除去 <executions>
从儿童pom纠正这一问题。有效pom有2处决的进行造成的重复安装Nexus回购。
总的来说,这个问题是破坏我们建设一段时间,并回答是没有用的-同上。而不是我的愚蠢设定的看似无害的appendAssemblyId假在家组件的一个人,获取附(阅读部署,公布)与我们的主要项目。E.g.:
<execution>
<id>ci-groovy-distrib</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>my-extra-assembly</descriptorRef>
</descriptorRefs>
<!-- This is the BUG: the assemblyID MUST be appended
because it is the classifier that distinguishes
this attached artifact from the main one!
-->
<appendAssemblyId>false</appendAssemblyId>
<!-- NOTE: Changes the name of the zip in the build target directory
but NOT the artifact that gets installed, deployed, releaseed -->
<finalName>my-extra-assembly-${project.version}</finalName>
</configuration>
</execution>
在摘要:
大会插件使用的assemblyId作 分类 对于这神器,因此一个重要部分是独特的GAV坐标在专家的条件(实际上,它更像GAVC坐标-C分类).
该文件的名称 安装, 部署, 或 释放 实际上是建立从这些坐标。它的 不同的文件你看到你的目标目录.这就是为什么你的本地建立起来不错,但是你的释放将失败。
愚蠢的元素的唯一确定的地方建立工件名称和发挥任何一部分在它的其余部分。这是一个完整的红鲱鱼。
摘要的摘要: 400错误的联系是因为我们的额外的附加工件正在上传上的主要项目,因为它有同样的名字作为主要项目,因为它有同样的GAVC坐标作为主要项目,因为除去我唯一的区别协调:分类源自动从assemblyId.
调查发现这是一个漫长和曲折的道路答案就在那里所有的文件用于专家组件:
appendAssemblyId
布尔
设置虚假排除大会id 从大会最终名称,并创造得到大会 文物而无需分类。 因此,大会具有神器 同的格式包装的现行项目将取代 该文件为这个主要项目的神器.
- 默认值是:真的。
- 用户酒店是:大会。appendAssemblyId.
从 http://maven.apache.org/plugins/maven-assembly-plugin/single-mojo.html#attach
额外的大胆的是我的。该文件应该有一个很大的闪烁的警告:"设置这个虚假而放弃所有的希望"
我得到了一些帮助从这个回答关于一个不同的问题 专家组-插件:如何使用appendAssemblyId 说明那里从tunaki真的有帮助。
我配置的家释放插在与releaseProfile=false和不执行源伪配置。没有诀窍。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<arguments>-P!source-artifacts</arguments>
<useReleaseProfile>false</useReleaseProfile>
<goals>-Dmaven.test.skip=true deploy</goals>
</configuration>
</plugin>
</plugins>
</build>