我想向Nexus 中已发布的版本添加两个 zip 。
从本质上讲,它们是应用程序的压缩演示和同一应用程序的扩展版本,也是压缩的。
使用 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 只上传我实际配置的文件吗?