Question

The configuration below works but I end up with an extra directory that I don't want. So I have target/webapp/dep-A/<depedency contents>, what do i need to change to get it to be target/webapp/<depedency contents>?

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.8</version>
            <executions>
                <execution>
                    <id>unpack</id>
                    <phase>package</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>myGroup</groupId>
                                <artifactId>dep-A</artifactId>
                                <version>1.0-SNAPSHOT</version>
                                <type>zip</type>
                                <overWrite>true</overWrite>
                                <outputDirectory>${project.build.directory}/webapp</outputDirectory>
                            </artifactItem>
                        </artifactItems>
                        <overWriteSnapshots>true</overWriteSnapshots>
                    </configuration>
                </execution>
            </executions>
        </plugin>
Was it helpful?

Solution

Unfortunately the maven-dependency-plugin unpack goal has not a postprocess optional parameter letting you, for example, chmod-ing or moving files. So I don't think exists an elegant way to do what you want only using the maven-dependency-plugin.

In addition to the maven-dependency-plugin you might use the maven-antrun-plugin, binding it to a subsequent phase which the maven-dependency-plugin is binded to, to copy/move/delete your files and directories.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top