2010/6/7 Anders Hammar <and...@hammar.net>
>
> Could it be that it is looking for Data.xml at path
> foo/secondModule/Data.xml. I'm guessing that this is a plain Java thing
and
> not related to Maven.
>
> /Anders


Hi
To solve this problem , I tried to use maven-dependency-plugin:unpack to
solve my problem :
In my secondModule's POM , I added these snippets :

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-dependency-plugin</artifactId>
 <version>2.1</version>
  <executions>
    <execution>
      <id>data-copying</id>
      <phase>test-compile</phase>
      <goals>
        <goal>unpack</goal>
      </goals>
      <configuration>
        <artifactItems>
          <artifactItem>
            <groupId>foo</groupId>
            <artifactId>firstModule</artifactId>
            <type>jar</type>
            <includes>foo/firstModule/Data.xml</includes>

 <outputDirectory>${project.build.directory}/classes</outputDirectory>
          </artifactItem>
        </artifactItems>
      </configuration>
    </execution>
  </executions>
</plugin>

In this POM file , I try to unpack the first module , and copy the Data.xml
to classes/foo/firstModule/ directory , and then run tests.
And indeed , it is copied to the right directory , I can find the "Data.xml"
file in "target/classes/foo/firstModule" directory.
But maven test still complains it cannot read the File
(Properties.loadFromXML() throws NPE).

I tried other output directory , such as
${project.build.directory}/resources , and
${project.build.directory}/test-classes , but all in vain...

Reply via email to