You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by c_inconnu3 <c_...@yahoo.fr> on 2005/07/02 00:37:33 UTC

[M2] testResources not working ?

Hi,

I have this pom:

<?xml version="1.0" encoding="UTF-8"?>

<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 
maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>mygroup</groupId>
    <artifactId>tests</artifactId>
    <version>0.20-SNAPSHOT</version>

    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                </includes>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0-alpha-3</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
   
</project>

And a properties file in src/test/resources/a/b/c.
When I run m2 test the following always returns null:

InputStream inputStream = 
ClassLoader.getSystemResourceAsStream("a/b/c/myTest.properties");
System.out.println("**** " + inputStream);
inputStream = getClass().getResourceAsStream("a/b/c/myTest.properties");
System.out.println("**** " + inputStream);

This works in eclipse and the properties files are indeed copied into 
target/test-classes/a/b/c
I am certainly missing something but what ?

Thanks

David DIDIER


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [M2] testResources not working ?

Posted by c_inconnu3 <c_...@yahoo.fr>.
c_inconnu3 a écrit :

> Hi,
>
> I have this pom:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <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 
> maven-v4_0_0.xsd">
>
>    <modelVersion>4.0.0</modelVersion>
>
>    <groupId>mygroup</groupId>
>    <artifactId>tests</artifactId>
>    <version>0.20-SNAPSHOT</version>
>
>    <packaging>jar</packaging>
>
>    <dependencies>
>        <dependency>
>            <groupId>junit</groupId>
>            <artifactId>junit</artifactId>
>            <version>3.8.1</version>
>            <type>jar</type>
>            <scope>test</scope>
>        </dependency>
>    </dependencies>
>
>    <build>
>        <testResources>
>            <testResource>
>                <directory>src/test/resources</directory>
>                <includes>
>                    <include>**/*.properties</include>
>                </includes>
>            </testResource>
>        </testResources>
>
>        <plugins>
>            <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-compiler-plugin</artifactId>
>                <version>2.0-alpha-3</version>
>                <configuration>
>                    <source>1.5</source>
>                    <target>1.5</target>
>                </configuration>
>            </plugin>
>        </plugins>
>    </build>
>   </project>
>
> And a properties file in src/test/resources/a/b/c.
> When I run m2 test the following always returns null:
>
> InputStream inputStream = 
> ClassLoader.getSystemResourceAsStream("a/b/c/myTest.properties");
> System.out.println("**** " + inputStream);
> inputStream = getClass().getResourceAsStream("a/b/c/myTest.properties");
> System.out.println("**** " + inputStream);
>
> This works in eclipse and the properties files are indeed copied into 
> target/test-classes/a/b/c
> I am certainly missing something but what ?
>
> Thanks
>
> David DIDIER
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
An idea ?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: the default goal should be specified in the

Posted by dan tran <da...@gmail.com>.
http://maven.apache.org/reference/project-descriptor.html




On 7/1/05, Janos Mucsi <mu...@yahoo.com> wrote:
> Hi
> I am getting the message below. So far I have been using maven 1.0.2 Now  I am using
> Maven 1.1 beta 1
> Can somebody please show me a sample project.xml, etc. ?
> 
> Thanks.
> 
> Janos
> 
> DEPRECATED: the default goal should be specified in the <build> section of proje
> ct.xml instead of maven.xml
> build:start:
> 
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


the default goal should be specified in the

Posted by Janos Mucsi <mu...@yahoo.com>.
Hi 
I am getting the message below. So far I have been using maven 1.0.2 Now  I am using
Maven 1.1 beta 1
Can somebody please show me a sample project.xml, etc. ?
 
Thanks.
 
Janos

DEPRECATED: the default goal should be specified in the <build> section of proje
ct.xml instead of maven.xml
build:start: