maven-dependency-plugin 未使用 destFileName?
我确信这有效!
我有一个 Maven 依赖插件配置,用于将 java 服务包装器放入 appassembler 目标文件夹中的特定文件夹中。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.tanukisoftware</groupId>
<artifactId>wrapper</artifactId>
<version>3.2.1</version>
<classifier>${target.arch.classifier}</classifier>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/appassembler/jsw/projectnamehere/lib</outputDirectory>
<destFileName>wrapper-${target.arch}.dll</destFileName>
</artifactItem>
</artifactItem>
</artifactItems>
</configuration>
</plugin>
但它被写为wrapper.dll(这是存储库中的文件名)。 target.arch 设置为“windows-x86-32”。
这是日志文件的一部分:
[DEBUG] (s) groupId = org.tanukisoftware
[DEBUG] (s) artifactId = wrapper
[DEBUG] (s) version = 3.2.1
[DEBUG] (s) classifier = win32
[DEBUG] (s) type = jar
[DEBUG] (s) overWrite = true
[DEBUG] (s) outputDirectory = <projectfolder>\target\appassembler\jsw\SophisToTradeCacheConsumer\lib
[DEBUG] (s) destFileName = wrapper-windows-x86-32.dll
...
[DEBUG] (f) outputAbsoluteArtifactFilename = false
[DEBUG] (s) outputDirectory = <projectfolder>\target\dependency
[DEBUG] (s) overWriteIfNewer = true
[DEBUG] (s) overWriteReleases = false
[DEBUG] (s) overWriteSnapshots = false
...
[INFO] [dependency:unpack {execution: default-cli}]
[INFO] Configured Artifact: org.tanukisoftware:wrapper:win32:3.2.1:jar
[INFO] Unpacking C:\WORK\maven\repository\org\tanukisoftware\wrapper\3.2.1\wrapper-3.2.1-win32.jarto
<projectfolder>\target\appassembler\jsw\SophisToTradeCacheConsumer\lib
with Includes null and excludes:null
[DEBUG] Expanding: C:\WORK\maven\repository\org\tanukisoftware\wrapper\3.2.1\wrapper-3.2.1-win32.jar into <projectfolder>\target\appassembler\jsw\SophisToTradeCacheConsumer\lib
[DEBUG] expand complete
I'm sure this was working!
I have a maven dependency plugin config to put a java service wrapper into a particular folder in an appassembler target folder.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.tanukisoftware</groupId>
<artifactId>wrapper</artifactId>
<version>3.2.1</version>
<classifier>${target.arch.classifier}</classifier>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/appassembler/jsw/projectnamehere/lib</outputDirectory>
<destFileName>wrapper-${target.arch}.dll</destFileName>
</artifactItem>
</artifactItem>
</artifactItems>
</configuration>
</plugin>
But it gets written as wrapper.dll (which is the filename in the repo). target.arch is set to "windows-x86-32".
Here's part of the log file:
[DEBUG] (s) groupId = org.tanukisoftware
[DEBUG] (s) artifactId = wrapper
[DEBUG] (s) version = 3.2.1
[DEBUG] (s) classifier = win32
[DEBUG] (s) type = jar
[DEBUG] (s) overWrite = true
[DEBUG] (s) outputDirectory = <projectfolder>\target\appassembler\jsw\SophisToTradeCacheConsumer\lib
[DEBUG] (s) destFileName = wrapper-windows-x86-32.dll
...
[DEBUG] (f) outputAbsoluteArtifactFilename = false
[DEBUG] (s) outputDirectory = <projectfolder>\target\dependency
[DEBUG] (s) overWriteIfNewer = true
[DEBUG] (s) overWriteReleases = false
[DEBUG] (s) overWriteSnapshots = false
...
[INFO] [dependency:unpack {execution: default-cli}]
[INFO] Configured Artifact: org.tanukisoftware:wrapper:win32:3.2.1:jar
[INFO] Unpacking C:\WORK\maven\repository\org\tanukisoftware\wrapper\3.2.1\wrapper-3.2.1-win32.jarto
<projectfolder>\target\appassembler\jsw\SophisToTradeCacheConsumer\lib
with Includes null and excludes:null
[DEBUG] Expanding: C:\WORK\maven\repository\org\tanukisoftware\wrapper\3.2.1\wrapper-3.2.1-win32.jar into <projectfolder>\target\appassembler\jsw\SophisToTradeCacheConsumer\lib
[DEBUG] expand complete
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我看到您正在使用
dependency:unpack
但这个目标(逻辑上)不支持destFileName
(解压文件s时目标文件名没有真正意义)。对于您的情况,请在打包 dll 时使用“最终名称”。或者使用 Maven AntRun 插件进行一些后处理以重命名文件。
I see that you are using
dependency:unpack
but this goal (logically) doesn't supportdestFileName
(a destination filename doesn't really make sense when unpacking files).In your case, either use the "final name" when packaging your dll. Or do some post processing using the Maven AntRun Plugin to rename the file.