Hi,

This a common request and unfortunately the ${maven.test.classpath} variable
is not valuated in the surefire configuration plugin.

For the moment, I found a workaround but it is unsatisfactory

 <build>
    <plugins>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <phase>generate-test-resources</phase>
                <configuration>
                  <tasks>
                   <property
                       refid="maven.test.classpath" name="
maven.test.classpath">
                   </property>
                 <mkdir dir="${project.build.directory}/test-classes"/>
                 <echo
file="${project.build.directory}/test-classes/classpath.txt"
append="false">${maven.test.classpath}</echo>
                </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
        </plugin>
    </plugins>
  </build>

Then, in your testcase, you just have to read the generated classpath file.

HTH,

Rémy

Reply via email to