Usage

Some brief examples on how to use this plugin.

How to set a property which value is the absolute path to the artifact file for each selected project dependency (including transitive)

i.e.: This does the same thing as the dependency:properties goal.

<plugin>
    <groupId>org.bitstrings.maven.plugins</groupId>
    <artifactId>dependencypath-maven-plugin</artifactId>
    <version>1.1.1</version>
    <executions>
        <execution>
            <id>set-all</id>
            <goals>
                <goal>set</goal>
            </goals>
        </execution>
    </executions>
</plugin>

or

<plugin>
    <groupId>org.bitstrings.maven.plugins</groupId>
    <artifactId>dependencypath-maven-plugin</artifactId>
    <version>1.1.1</version>
    <executions>
        <execution>
            <id>set-all</id>
            <goals>
                <goal>set</goal>
            </goals>
            <configuration>
                <propertySets/>
            </configuration>
        </execution>
    </executions>
</plugin>

This will for example create a property like junit:junit:jar and commons-lang:commons-lang:jar.

How to include/exclude dependencies

Specify a list of dependencies to be included or excluded by adding <includes>/<include> or <excludes>/<exclude> in your pom.xml.

<plugin>
    <groupId>org.bitstrings.maven.plugins</groupId>
    <artifactId>dependencypath-maven-plugin</artifactId>
    <version>1.1.1</version>
    <executions>
        <execution>
            <id>set-all</id>
            <goals>
                <goal>set</goal>
            </goals>
        </execution>
        <configuration>
            <propertySets>
                <propertySet>
                    <includes>
                        <include>junit:junit:jar</include>
                        <include>org.apache.maven:maven-core:jar</include>
                    </includes>
                </propertySet>
            </propertySets>
        </configuration>
    </executions>
</plugin>

How to set a property which value a relative path to the artifact file for each selected project dependency (excluding transitive)

Use the relativeTo parameter to base your relative path on. This will also automatically append ".relative" to the property name. If you do not want to include transitive dependencies just set the transitive parameter to false. Further more, you can set suffix which will append a suffix to the parameter name, in this case ".builddir".

<plugin>
    <groupId>org.bitstrings.maven.plugins</groupId>
    <artifactId>dependencypath-maven-plugin</artifactId>
    <version>1.1.1</version>
    <executions>
        <execution>
            <id>set-relative-builddir</id>
            <goals>
                <goal>set</goal>
            </goals>
            <configuration>
                <propertySets>
                    <propertySet>
                        <suffix>builddir</suffix>
                        <relativeTo>${project.build.directory}</relativeTo>
                        <transitive>false</transitive>
                    </propertySet>
                </propertySets>
            </configuration>
        </execution>
    </executions>
</plugin>

This will for example create a property like junit:junit:jar.relative.builddir and commons-lang:commons-lang:jar.relative.builddir.

How to disable the automatic ".relative" suffix

Set the autoRelativeSuffix to false, this will not add the ".relative" suffix to the property name.

<plugin>
    <groupId>org.bitstrings.maven.plugins</groupId>
    <artifactId>dependencypath-maven-plugin</artifactId>
    <version>1.1.1</version>
    <executions>
        <execution>
            <id>set-relative-builddir</id>
            <goals>
                <goal>set</goal>
            </goals>
            <configuration>
                <propertySets>
                    <propertySet>
                        <suffix>builddir</suffix>
                        <relativeTo>${project.build.directory}</relativeTo>
                        <transitive>false</transitive>
                        <autoRelativeSuffix>false</autoRelativeSuffix>
                    </propertySet>
                </propertySets>
            </configuration>
        </execution>
    </executions>
</plugin>

This will for example create a property like junit:junit:jar.builddir and commons-lang:commons-lang:jar.builddir.

For full documentation, click here.