How to get Maven testResources directories inside pom

In the Maven pom.xml, I can get some of the build values ​​that were defined in the build section. for example ${project.build.testSourceDirectory}

:

    <build>
            <directory>${project.basedir}/target</directory>
            <outputDirectory>${project.build.directory}/classes</outputDirectory>
            <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
            <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
            <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
            <resources>
                <resource>
                    <directory>${project.basedir}/src/main/java/resources</directory>
                </resource>
            </resources>
            <testResources>
                <testResource>
                    <directory>${project.basedir}/src/test/resources</directory>
                </testResource>
            </testResources>
   ...

      

Is there anyway to get the value of the testResources directory which is a child of the testResource? I tried ${project.build.testResources[0].directory}

it but it doesn't work.

+3


source to share


2 answers


I was looking for the same value and ended up with no result. These documents confirm my fear that this is not possible:



http://books.sonatype.com/mvnref-book/reference/resource-filtering-sect-properties.html#resource-filtering-sect-project-properties

+4


source


Try it.

project.testResources[0].directory



He works in this environment.

Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T18:29:23+01:00) Java version: 1.8.0_45-internal, vendor: Oracle Corporation OS name: "linux", version: "3.13.0-46-generic", arch: "amd64", family: "unix"

+1


source







All Articles