maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Inred <inr...@gmail.com>
Subject mvn test can't find the resource but mvn exec:exec running is ok
Date Wed, 19 Jun 2013 08:14:01 GMT
my pom.xml

   <groupId>org.codehaus.mojo</groupId>
   <artifactId>exec-maven-plugin</artifactId>
   <version>1.2.1</version>
   <configuration>
      <executable>java</executable>
      <arguments>
    <argument>-classpath</argument>

    <classpath/>
    <argument>helper.BaseCheckerTest</argument>
      </arguments>
</configuration>

</plugin>

            <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>exec-maven-plugin</artifactId>
   <version>1.2.1</version>
   <executions>
<execution>
 <phase>process-test-classes</phase>
 <goals>
  <goal>java</goal>
 </goals>
 </execution>
   </executions>
 <configuration>
  <mainClass>helper.BaseCheckerTest</mainClass>
  <classpathScope>runtime</classpathScope>

  <args>
     <arg>-classpath</arg>
            <classpath/>

  </args>
 </configuration>

</plugin>



it's ok when
c:\>mvn  exec:exec

but it report that can't find the resouce file config.properties when i do
c:\>mvn test

Class BaseCheckerTest{
static {
 try {
 prop = new Properties();
prop.load(ClassLoader.class.getResourceAsStream("/config.properties"));
 } catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 }
}



c:\>mvn --version
Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)
Maven home: C:\Downloads\apache-maven-3.0.4\bin\..
Java version: 1.6.0_24, vendor: Sun Microsystems Inc.
Java home: C:\Program Files (x86)\Java\jdk1.6.0_24\jre

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message