8

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
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Paul McKenzie
  • 19,646
  • 25
  • 76
  • 120

1 Answers1

5

I see that you are using dependency:unpack but this goal (logically) doesn't support destFileName (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.

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • Hmm, I kind of think that if destFileName is provided then the plugin should honour it, but we are where we are. – Paul McKenzie Sep 03 '10 at 08:09
  • @Paul Well, you can try to submit a RFE but in my opinion, it doesn't make sense to provide a (unique) destination file name for the (multiple) file names included in an archive. – Pascal Thivent Sep 03 '10 at 08:36
  • 1
    no, you're probably right. Would be nice if the plugin said something about ignoring the destfilename tag however. – Paul McKenzie Sep 03 '10 at 09:22
  • 1
    Seems this page needs to be updated, then https://maven.apache.org/plugins/maven-dependency-plugin/examples/unpacking-artifacts.html – OneCricketeer Jun 25 '19 at 19:25