You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dennis Lundberg <de...@apache.org> on 2013/07/19 22:45:39 UTC
Re: mvn test can't find the resource but mvn exec:exec running is ok
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 <in...@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