maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Lundberg <denn...@apache.org>
Subject Re: mvn test can't find the resource but mvn exec:exec running is ok
Date Fri, 19 Jul 2013 20:45:39 GMT
Hi

Where in your source tree is the file config.properties located?

Also, it looks like you are feeding exec-maven-plugin an empty classpath in
<args></args>.

On Wed, Jun 19, 2013 at 10:14 AM, Inred <inred9@gmail.com> wrote:

> 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
>
> --
> Dennis Lundberg

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