1

I have one main and one test config file which is shared by several maven projects. While testing, I am specifying the classpath to the directory where the test config file is.

This works fine if the whole project is tested/build but it doesn't work while running single tests. The config file is not found in the classpath.

here is the config:

<plugin>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <additionalClasspathElements>
       <element>${project.parent.basedir}/conf/test</element>
    </additionalClasspathElements>
  </configuration>
</plugin>

any ideas why surefire ignores the property for running single tests?

thank you

4

2 回答 2

4

不应该是:

<additionalClasspathElements>
  <additionalClasspathElement>${project.parent.basedir}/conf/test</additionalClasspathElement>
</additionalClasspathElements>
于 2012-01-16T18:29:01.967 回答
0

将配置文件放在 src/test/resources 文件夹中并尝试它。它应该会自动被拾取。或者尝试放在 src/main/resources 下并使用标记指向项目的 pom.xml 中的该配置文件。使用 2.5 版本的 maven-surefire 插件。

于 2010-10-24T11:46:11.583 回答