Maven 程序集忽略依赖工件的 FinalName
我有一个分层的 Maven 项目,我试图从中构建几个子模块的本机安装程序。我在父 POM 中使用我的产品名称作为前缀:
,以便我的所有工件 jar 都具有标准命名约定。
xyz-parent
+-- util
+--- target/xyz-util.jar
+-- core
+--- target/xyz-core.jar
+-- app1 <--- "builds an installer as part of the package phase"
+--- target/xyz-app1.jar
+-- app2 <--- "builds an installer as part of the package phase"
...
我需要将所有依赖的jar具体化到一个目录中(因为inno setup对maven一无所知)。因此,对于作为安装程序的每个子模块,我计划使用 maven-assemble-plugin,然后在我的 inno 设置中使用类似以下内容:
Source: "target\pkg\lib\*.jar"; DestDir: "{app}\external"; Flags: ignoreversion;
当我运行 mvn clean package
时,我得到一个 target /xyz-app1-bin/xyz-app1/lib
目录包含所有依赖的 jar,但是我的兄弟项目生成的 jar 都没有正确的最终名称(例如,我有 util-0.0.1)。 1-SNAPSHOT.jar 而不是 xyz-util.jar
)
此问题看起来类似于 这篇文章,但我不知道“attach”是什么(可能已弃用)。
I have a hierarchical maven project, from which I am trying to build a native installer for several of the sub-modules. I am using my product name as a prefix: <finalName>xyz-${artifactId}</finalName>
in the parent POM so that all my artifact jars have a standard naming convention.
xyz-parent
+-- util
+--- target/xyz-util.jar
+-- core
+--- target/xyz-core.jar
+-- app1 <--- "builds an installer as part of the package phase"
+--- target/xyz-app1.jar
+-- app2 <--- "builds an installer as part of the package phase"
...
I need to materialize all the dependent jars into a directory (since inno setup knows nothing about maven). So for each submodule which is an installer I plan to use maven-assembly-plugin, then use something like the following in my inno setup:
Source: "target\pkg\lib\*.jar"; DestDir: "{app}\external"; Flags: ignoreversion;
When I run mvn clean package
, I get a target/xyz-app1-bin/xyz-app1/lib
directory with all of the dependent jars, however none of the jars produced by my sibling projects have their correct final names (e.g. I have util-0.0.1-SNAPSHOT.jar
instead of xyz-util.jar
)
This problem seems similar to this post, but I have no idea what "attach" is (perhaps deprecated).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我无法直接使用 FinalName,但是,我确实设法使用依赖项集重新实现了我想要的 FinalName 逻辑——从而将我的依赖项划分为外部和内部集(基于 groupId):
I was unable to use finalName directly, however, I did manage to re-implement the finalName logic I wanted using dependency sets -- thus partitioning my dependencies into an external and internal set (based on the groupId):
您应该能够直接使用 FinalName (这对我有用):
You should be able to use finalName directly using (this worked for me) :