使用 maven- assembly-plugin 重命名 zip 工件
我花了无数的时间试图解决这个问题,但我仍然一无所知,希望有人能伸出援手。这是我的情况:
- 我有一个创建 zip 工件的程序集描述符。该 zip 的名称来自 artifact_id 和 pom.xml 文件中定义的版本。我想更改此工件的名称。我在 pom 的插件部分下添加了一个元素,如下所示:
(finalName)somename.${var1}-${var2}(/finalName) -->我在 fileName 元素周围使用括号,因为不知何故我无法在此编辑器中使用括号。
这些 ${var1} 和 ${var2} 在外部 .properties 文件中定义。为了读取这些变量,我使用了properties-maven-plugin。我无法在 pom 中定义这些变量,因为它们会针对每个部署而更改,并且无法从 cmd 行提供。当我运行 mvn assembly:single 时,zip 工件将创建为 somename.null-null.zip。 .properties 文件中定义的属性似乎为空或未评估。当我在调试模式下运行 mvn 时,我看到资源设置正确:var1=something 和 var2=somethingelse。他们都有正确的价值观。我现在很茫然。任何帮助将不胜感激。
I've spent countless hours trying to resolve this issue but i'm still on the dark and hoping someone could give a helping hand. Here is my situation:
- i have an assembly descriptor that creates a zip artifact. The name of this zip comes from the artifact_id and the version defined in the pom.xml file. I would like to change the name of this artifact. i have added a element in my pom under the plugin section of the to look like:
(finalName)somename.${var1}-${var2}(/finalName) --> i'm using parenthesis here around the fileName element since somehow i cannot use the brackets in this editor.
These ${var1} and ${var2} are defined in an external .properties file. To read in these vars i'm using the properties-maven-plugin. I cannot define these vars within the pom cuz they change for each deployment and cannot be provided from the cmd line. When i run mvn assembly:single, the zip artifact is created as somename.null-null.zip. It looks like the properties defined in the .properties files are null or not being evaluated. When i run mvn in debug mode, i see that the resources are set properly: var1=something and var2=somethingelse. They both have the right values. I'm at loss right now. Any help will be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)