简体   繁体   English

Maven部署而不上传任何pom文件

[英]Maven deploying without uploading any pom file

I'm building a multiplatform javafx application. 我正在构建一个多平台javafx应用程序。 The final process is to create an installer (exe,dmg,deb.. with jre bundled) and upload it to a special "product release" repo. 最后的过程是创建一个安装程序(捆绑了jre的exe,dmg,deb ..)并将其上传到特殊的“产品发行”存储库中。 Given how javafx build needs to be done, it runs an jenkins matrix job on 3 different platforms. 鉴于需要完成javafx构建,它将在3个不同平台上运行jenkins矩阵作业。 The last step is the deployment. 最后一步是部署。 I attach the installer with the build-helper-maven plugin. 我为安装程序附加了build-helper-maven插件。

I'm able to upload the installer correctly for one platform, but because the deploy seems to upload the pom file, it cannot be uploaded again from another jenkins slave. 我能够为一个平台正确上载安装程序,但是由于部署似乎上载了pom文件,因此无法从另一个jenkins从站再次上载该文件。

First I was having problem of maven uploading the "main jar", but I managed to disable that by binding the jar plugin to 'none' phase (I use the maven-javafx-plugin which creates own main jar). 首先,我遇到了maven上传“主jar”的问题,但是我设法通过将jar插件绑定到“ none”阶段来禁用它(我使用了创建自己的主jar的maven-javafx-plugin)。 However I'm unable to disable the pom generation and uploading. 但是我无法禁用pom的生成和上传。 I have set 我已经设定

<generatePom>false</generatePom> 

for the maven-deploy-plugin but it seems to not have any effect (I assume it works for the main jar which I have already disabled). 对于maven-deploy-plugin,但似乎没有任何效果(我认为它适用于已经禁用的主jar)。

Is it possible to disable the pom generation/upload completely (similar like gradle's 'uploadDescriptor false' option) and only upload 'attached artifacts' ? 是否可以完全禁用pom生成/上传(类似于gradle的“ uploadDescriptor false”选项),而仅上传“附加工件”?

EDIT/NOTE: I probably try the deploy file option next, https://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html , but it would be nice to know if this can be done on the complete project level 编辑/注意:我可能接下来尝试使用“部署文件”选项https://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html ,但是很高兴知道这是否可以在整个项目级别完成

I managed to solve this. 我设法解决了这个问题。 I did it with the deploy-file option: 我用deploy-file选项做到了:

I bound the default-deploy to none in order to disable it. 我将default-deploy绑定为none以禁用它。 Then I made new "native-deploy" execution which I bound to deploy phase. 然后,我执行了新的“本机部署”执行,并绑定到部署阶段。 In it's configuration I put the generatePom false and pointed the file to the same I was earlier using to attach it as side artifact (via the build helper plugin). 在它的配置中,我将generatePom设置为false,并将文件指向我之前使用的附加文件,以将其作为附加工件(通过构建助手插件)附加。 I did have to put the coodrinates again (ie passtrough from project.*). 我确实必须再次放置共精酸盐(即来自project。*的通过槽)。 But did work and uploaded the installers from all machines without any pom files. 但是可以正常工作,并且从所有计算机上载了安装程序,没有任何pom文件。 I did have to re-enable the default jar creation because maven complained that there is no artifact bound (I guess I could change the packaging to be pom, anyway it is not uploaded because the default upload is disabled so ok there). 我确实必须重新启用默认的jar创建,因为maven抱怨没有绑定的工件(我想我可以将包装更改为pom,无论如何它都不会上传,因为默认上传被禁用了,所以可以)。

I guess if there is more general solution it would be more correct answer but for me this is enough. 我想如果有更通用的解决方案,那将是更正确的答案,但是对我来说这已经足够了。

The maven-deploy-plugin has the configuration option skip which takes a boolean value and suppresses the execution of this plugin if set to true . maven-deploy-plugin具有配置选项skip ,该选项具有布尔值,如果设置为true ,则禁止执行此插件。

I think this is what you are looking for. 我认为这就是您想要的。

Apache Maven Deploy Plugin documentation Apache Maven Deploy插件文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM