Good day, In addition to Sudheendra's message, you'd for your test resources
<project> ... <build> ... <testResources> <testResource> <directory>src/test/java/resources</directory> </testResource> </testResources> </build> </project> Btw, the default resource directories for the main and for the test are src/main/resources and src/test/resources respectively. Cheers, Franz Cristian D. Romanescu wrote: > > Thanks, found the problem. I was loading the resource via: > > Thread.currentThread().getClass().getResource( "config.xml" ); > > replaced with > > getClass().getResource( "config.xml" ); > > and works fine now! > > Thank you, > Cristian. > > Singh, Sudheendra GNI CON wrote: >> Hi, >> You need to use >> <build> >> ..... >> <testSourceDirectory>src/test/java</testSourceDirectory> >> <testOutputDirectory>target/test-classes </testOutputDirectory> >> .... >> </build> >> Cheers, >> Sudheendra N Singh >> >> -----Original Message----- >> From: Cristian D. Romanescu [mailto:[EMAIL PROTECTED] >> Sent: 11 April 2007 17:25 >> To: [EMAIL PROTECTED] >> Subject: Newbie: running mvn test problem with configuration files and >> current directory >> >> Hello, >> >> I just downloaded maven and played a little bit with it. >> I have the following problem (maven 2.0.6): >> >> project structure >> >> . >> | >> src >> | main >> | | >> | java >> | test >> | java >> | |src >> | |resources >> | |myconfig.xml >> pom.xml >> >> When I run mvn test, everything works fine, sources are compiled, >> resources are copied into test-classes etc. >> When tests run, tests assumes that configuration file "config.xml" in >> current directory, which is "." and resource file went to >> ./test-classes/config.xml. >> >> I don't understand why current directory when running tests is not >> "./test-classes/". What should I do? How to tell maven which >> directory is current for runing tests? Or should I use another method to >> load configuration file? >> >> Thank you, >> Cristian. >> >> >> Here is my pom.xml >> >> >> <project xmlns="http://maven.apache.org/POM/4.0.0" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 >> http://maven.apache.org/maven-v4_0_0.xsd"> >> <modelVersion>4.0.0</modelVersion> >> <groupId>ro.romanescu.eximius</groupId> >> <artifactId>eximius</artifactId> >> <packaging>jar</packaging> >> <version>1.0</version> >> <name>eximius</name> >> <url>http://maven.apache.org</url> >> <build> >> <plugins> >> <plugin> >> <groupId>org.apache.maven.plugins</groupId> >> <artifactId>maven-compiler-plugin</artifactId> >> <configuration> >> <source>1.5</source> >> <target>1.5</target> >> </configuration> >> </plugin> >> </plugins> >> </build> >> >> <dependencies> >> <dependency> >> <groupId>junit</groupId> >> <artifactId>junit</artifactId> >> <version>4.3.1</version> >> <scope>test</scope> >> </dependency> >> <dependency> >> <groupId>log4j</groupId> >> <artifactId>log4j</artifactId> >> <version>1.2.12</version> >> <scope>runtime</scope> >> </dependency> >> <dependency> >> <groupId>dom4j</groupId> >> <artifactId>dom4j</artifactId> >> <version>1.6.1</version> >> <scope>runtime</scope> >> </dependency> >> <dependency> >> <groupId>jaxen</groupId> >> <artifactId>jaxen</artifactId> >> <version>1.1</version> >> <scope>runtime</scope> >> </dependency> >> </dependencies> >> </project> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> ------------------------------------------------------------------------------ >> CONFIDENTIALITY NOTICE: If you have received this email in error, please >> immediately notify the sender by e-mail at the address shown. This email >> transmission may contain confidential information. This information is >> intended only for the use of the individual(s) or entity to whom it is >> intended even if addressed incorrectly. Please delete it from your files >> if you are not the intended recipient. Thank you for your compliance. >> Copyright 2007 CIGNA >> ============================================================================== >> >> >> --------------------------------------------------------------------- >> 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] > > > -- View this message in context: http://www.nabble.com/Newbie%3A-running-mvn-test-problem-with-configuration-files-and-current-directory-tf3560453s177.html#a9953515 Sent from the Maven - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]