1

I need to unpack an artifact, and I need to use it's unpacked location in several places (in multiple files). I don't want to have to update all the copies of that location every time I change versions. Is there a way I can strip the version from the output directory? It doesn't look like stripVersion is supported with the unpack mojo.

Jared
  • 1,887
  • 3
  • 20
  • 45
  • Can you post your `maven-dependency-plugin` configuration from your `pom` so we can debug? – orien Nov 18 '11 at 20:12

2 Answers2

0

Does the plugin you are using to create the artifact provide a xyzName property? For example the jar-plugin provides the finalName and the war-plugin has the warName.

If so you can set the property to some fixed value.

Sri Sankaran
  • 8,120
  • 4
  • 38
  • 47
-1

Try this:

<properties>
    <extracted-artifact-location>${project.build.directory}/extracted-artifact</extracted-artifact-location>
</properties>
...
<build>
    <plugins>
        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.3</version>
            <executions>
                <execution>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId><fixme></groupId>
                                <artifactId><fixme></artifactId>
                                <version><fixme></version>
                                <outputDirectory>${extracted-artifact-location}</outputDirectory>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
orien
  • 2,130
  • 16
  • 20
  • This is what I have, and it puts the extracted artifact in "${extracted-artifact-location}/${artifactId}-${version}/". I want it in "${extracted-artifact-location}/${artifactId}/" – Jared Nov 18 '11 at 15:43
  • @Jared With this configuration I end up with the contents of the dependency extracted directly in the `${extracted-artifact-location}` directory. You'll need to post your configuration for more help. Please show the relevant configuration for the `maven-dependency-plugin` from your pom and parent pom it inherits from. – orien Nov 18 '11 at 20:18