This seems like a bug with maven and recursive builds.  Perhaps it
should be resetting the system property, user.dir, to be the ${basedir}.
As a work around, you can add the following configuration for surefire:

        <configuration>
          <systemProperties>
            <property>
              <name>user.dir</name>
              <value>${basedir}</value>
            </property>           
          </systemProperties>
        </configuration>

-----Original Message----
From: Lyndon Washington [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 07, 2006 8:43 PM
To: Maven Users List
Subject: Re: Referencing Files from a Unit Test

Wendy,

What I have noticed is that if I go into the sub projects directory and
run
'mvn test', the relative paths that are in the tests resolve perfectly.
When I run the 'mvn test' from the parent project path, then the
relative
paths cannot be found.  Will the use of the "basedir" property resolve
to
the subprojects location or the parent projects location?

Thanks,
-Lyndon-

On 6/5/06, Wendy Smoak <[EMAIL PROTECTED]> wrote:
>
> On 6/5/06, Lyndon Washington <[EMAIL PROTECTED]> wrote:
>
> > I have a unit test that was setup in the old ANT build to load
resources
> > using a relative path.  I have put the resource that is being
retrieved
> in
> > the projects 'test/resources/conf' folder.  How would I reference
the
> file,
> > where previously I used 'conf/foo.xml'?
> >
> > I guess I was assuming that there would be a system propery that I
could
> > use.  Another snippet of info is that this project is part of a
large
> pom
> > heirarchy, so the test could be run from the parent or from the
actual
> > project location.
>
> http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html
>
> Surefire sets a 'basedir' system property, which you can retrieve
with:
>    System.getProperty("basedir")
>
> It also sets 'localRepository', which can be useful for locating
> artifacts (such as war files to deploy with Cargo.)
>
> In addition, you can pass in your own system properties in the
> <plugin>/<configuration> section.
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to