我想在Nexus中add two zips to an already published version 基本上,它们是应用程序的压缩演示和同一应用程序的扩展版本,也是压缩的。
使用Deploy插件,我在我的pom中定义了两个执行,每个文件一个,并将它们绑定到部署阶段。这是演示的一个:
<execution>
<id>deploy-essential</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<file>${project.build.directory}/${project.artifactId}-${project.version}-demo.zip</file>
<groupId>${project.groupId}</groupId>
<artifactId>myproject</artifactId>
<version>${project.version}</version>
<classifier>demo</classifier>
<repositoryId>nexus</repositoryId>
<url>${targetrepository}</url>
<generatePom>false</generatePom>
</configuration>
</execution>
我希望Maven上传文件并在执行此时执行时将元数据更新到给定的G / A / V坐标。 相反,它会上传给定文件,并将包含完整版本的姐妹文件上传到给定坐标,然后将它们再次上传到原始坐标。
然后继续为第二次执行再做所有这些。这是我日志的摘录:
[INFO] --- maven-deploy-plugin:2.7:deploy-file (deploy-demo) @ bundle ---
Downloading: http://nexus/repositories/snapshots/mygroup/myproject/1.2.6-SNAPSHOT/maven-metadata.xml
2 KB
Downloaded: http://nexus/repositories/snapshots/mygroup/myproject/1.2.6-SNAPSHOT/maven-metadata.xml (2 KB at 4.8 KB/sec)
Uploading: http://nexus/repositories/snapshots/mygroup/myproject/1.2.6-SNAPSHOT/myproject-1.2.6-20121130.102624-5-demo.zip
...
Uploaded: http://nexus/repositories/snapshots/mygroup/myproject/1.2.6-SNAPSHOT/myproject-1.2.6-20121130.102624-5-demo.zip (13032 KB at 23105.2 KB/sec)
Downloading: http://nexus/repositories/snapshots/mygroup/myproject/maven-metadata.xml
533 B
Downloaded: http://nexus/repositories/snapshots/mygroup/myproject/maven-metadata.xml (533 B at 34.7 KB/sec)
Uploading: http://nexus/repositories/snapshots/mygroup/myproject/1.2.6-SNAPSHOT/maven-metadata.xml
2 KB
Uploaded: http://nexus/repositories/snapshots/mygroup/myproject/1.2.6-SNAPSHOT/maven-metadata.xml (2 KB at 89.4 KB/sec)
Uploading: http://nexus/repositories/snapshots/mygroup/myproject/maven-metadata.xml
533 B
Uploaded: http://nexus/repositories/snapshots/mygroup/myproject/maven-metadata.xml (533 B at 32.5 KB/sec)
Downloading: http://nexus/repositories/snapshots/mygroup/bundle/1.2.6-SNAPSHOT/maven-metadata.xml
861 B
Downloaded: http://nexus/repositories/snapshots/mygroup/bundle/1.2.6-SNAPSHOT/maven-metadata.xml (861 B at 3.8 KB/sec)
Uploading: http://nexus/repositories/snapshots/mygroup/bundle/1.2.6-SNAPSHOT/bundle-1.2.6-20121130.102625-3-full.zip
...
Uploaded: http://nexus/repositories/snapshots/mygroup/bundle/1.2.6-SNAPSHOT/bundle-1.2.6-20121130.102625-3-full.zip (13065 KB at 18531.7 KB/sec)
Downloading: http://nexus/repositories/snapshots/mygroup/bundle/maven-metadata.xml
410 B
Downloaded: http://nexus/repositories/snapshots/mygroup/bundle/maven-metadata.xml (410 B at 8.5 KB/sec)
Uploading: http://nexus/repositories/snapshots/mygroup/bundle/1.2.6-SNAPSHOT/maven-metadata.xml
861 B
Uploaded: http://nexus/repositories/snapshots/mygroup/bundle/1.2.6-SNAPSHOT/maven-metadata.xml (861 B at 27.1 KB/sec)
Uploading: http://nexus/repositories/snapshots/mygroup/bundle/maven-metadata.xml
410 B
Uploaded: http://nexus/repositories/snapshots/mygroup/bundle/maven-metadata.xml (410 B at 5.1 KB/sec)
Uploading: http://nexus/repositories/snapshots/mygroup/bundle/1.2.6-SNAPSHOT/bundle-1.2.6-20121130.102625-3-demo.zip
...
Uploaded: http://nexus/repositories/snapshots/mygroup/bundle/1.2.6-SNAPSHOT/bundle-1.2.6-20121130.102625-3-demo.zip (13032 KB at 13631.1 KB/sec)
Uploading: http://nexus/repositories/snapshots/mygroup/bundle/1.2.6-SNAPSHOT/maven-metadata.xml
861 B
Uploaded: http://nexus/repositories/snapshots/mygroup/bundle/1.2.6-SNAPSHOT/maven-metadata.xml (861 B at 56.1 KB/sec)
对于SNAPSHOT来说这不是一件大事,但它完全阻止了发布,因为Nexus配置为拒绝重新部署。
我不认为这种行为是有意的,我相信我错过了一些东西。 我可以以某种方式让Maven只上传我实际配置的文件吗?
答案 0 :(得分:1)
为什么不使用可以将工件附加到当前部署的程序集插件,或者使用build-helper-maven-plugin,它可以简单地将其他工件附加到您的构建中。在通常的构建过程中使用部署插件是错误的方法。
答案 1 :(得分:1)
因为您没有禁用默认部署机制,所以它仍在执行中。你需要这样的东西:
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<executions>
<!-- disable standard deploy -->
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
<execution>
<id>deployEssential</id>
<phase>deploy</phase>
...
</execution>
</executions>
</plugin>
答案 2 :(得分:1)
使用内置部署插件(用于部署maven工件)的替代方法:
wagon-maven-plugin
HOME/.m2/settings.xml
mvn deploy
复制FTP文件<!-- disable standard deploy -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>deploy-release</id>
<phase>deploy</phase>
<goals>
<goal>upload</goal>
</goals>
<configuration>
<serverId>nexus</serverId>
<url>${targetrepository}</url>
<fromDir>${project.build.directory}</fromDir>
<toDir>${project.version}</toDir>
<includes>${project.artifactId}-${project.version}-demo.zip</includes>
</configuration>
</execution>
</executions>
</plugin>