You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Marco Mistroni <mm...@gmail.com> on 2006/03/07 16:06:30 UTC
Maven2 tests
Hi all,
i m trying ot use Maven2 in my project,.....
structure of my dir is
<mydir>
|__src
|____main
|___ java
|___ resources
|___ test
|__ java
i m trying to run some junit tests.
according to docs ihave read (about maven directory structure), i should
place
tests in the test\java directory.. but when i do that, maven-surefire-plugin
does not find them
it finds them only if i put int he src\main\test directory
what is the correct approach?
this is my current pom.xml
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>root</groupId>
<artifactId>ejbs</artifactId>
<packaging>ejb</packaging>
<version>1.0</version>
<name>enterprise java beans</name>
<parent>
<groupId>root</groupId>
<artifactId>project</artifactId>
<version>1.0</version>
</parent>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<url>http://cvs.apache.org/maven-snapshot-repository</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>apache.snapshots</id>
<url>http://cvs.apache.org/maven-snapshot-repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>root</groupId>
<artifactId>shared</artifactId>
</dependency>
<dependency>
<groupId>geronimo-spec</groupId>
<artifactId>geronimo-spec-j2ee</artifactId>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-ejb3x</artifactId>
<version>4.0.3</version>
<scope>system</scope>
<systemPath>${basedir}\lib\jboss-ejb3x-4.0.3.jar</systemPath>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>ejb3-persistence</artifactId>
<version>4.0.3</version>
<scope>system</scope>
<systemPath>${basedir}\lib\ejb3-persistence-4.0.3.jar</systemPath>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>4.6.1</version>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>run server side JUnits from tests_Serverside</id>
<phase>integration-test</phase>
<configuration>
<reportFormat>xml</reportFormat>
<includes>
<include>**/*.java </include>
</includes>
<testFailureIgnore>false</testFailureIgnore>
<testClassesDirectory>target/test-classes</testClassesDirectory>
<classesDirectory>/target/classes</classesDirectory>
</configuration>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin>
<groupId>org.testng</groupId>
<artifactId>maven-testng-plugin</artifactId>
<configuration/>
</plugin>-->
</plugins>
</build>
</project>
anyone could help?
thanks in advance and regards
marco
Re: Maven2 tests
Posted by Marco Mistroni <mm...@gmail.com>.
Hello,
... i saw it on a post in some mailing lists on google, while
doing a search on surefire plugins
thanks for advices
regards
marco
On 3/7/06, Wayne Fay <wa...@gmail.com> wrote:
>
> Docs are wrong.
>
> Test files go in:
> src/test/java
>
> Where did you see this "test/java" directory reference? It needs to be
> changed.
>
> Wayne
>
>
> On 3/7/06, Marco Mistroni <mm...@gmail.com> wrote:
> > Hi all,
> > i m trying ot use Maven2 in my project,.....
> >
> > structure of my dir is
> >
> > <mydir>
> > |__src
> > |____main
> > |___ java
> > |___ resources
> >
> > |___ test
> > |__ java
> >
> >
> > i m trying to run some junit tests.
> > according to docs ihave read (about maven directory structure), i should
> > place
> > tests in the test\java directory.. but when i do that,
> maven-surefire-plugin
> > does not find them
> >
> > it finds them only if i put int he src\main\test directory
> >
> > what is the correct approach?
> >
> > this is my current pom.xml
> >
> > <project>
> > <modelVersion>4.0.0</modelVersion>
> > <groupId>root</groupId>
> > <artifactId>ejbs</artifactId>
> > <packaging>ejb</packaging>
> > <version>1.0</version>
> > <name>enterprise java beans</name>
> > <parent>
> > <groupId>root</groupId>
> > <artifactId>project</artifactId>
> > <version>1.0</version>
> > </parent>
> > <pluginRepositories>
> > <pluginRepository>
> > <id>apache.snapshots</id>
> > <url>http://cvs.apache.org/maven-snapshot-repository</url>
> > </pluginRepository>
> > </pluginRepositories>
> > <repositories>
> > <repository>
> > <id>apache.snapshots</id>
> > <url>http://cvs.apache.org/maven-snapshot-repository</url>
> > </repository>
> > </repositories>
> > <dependencies>
> > <dependency>
> > <groupId>root</groupId>
> > <artifactId>shared</artifactId>
> > </dependency>
> > <dependency>
> > <groupId>geronimo-spec</groupId>
> > <artifactId>geronimo-spec-j2ee</artifactId>
> > </dependency>
> > <dependency>
> > <groupId>jboss</groupId>
> > <artifactId>jboss-ejb3x</artifactId>
> > <version>4.0.3</version>
> > <scope>system</scope>
> > <systemPath>${basedir}\lib\jboss-ejb3x-4.0.3.jar</systemPath>
> > </dependency>
> > <dependency>
> > <groupId>jboss</groupId>
> > <artifactId>ejb3-persistence</artifactId>
> > <version>4.0.3</version>
> > <scope>system</scope>
> > <systemPath>${basedir}\lib\ejb3-persistence-4.0.3.jar
> </systemPath>
> > </dependency>
> >
> > <dependency>
> > <groupId>org.testng</groupId>
> > <artifactId>testng</artifactId>
> > <version>4.6.1</version>
> > <scope>test</scope>
> > <classifier>jdk15</classifier>
> > </dependency>
> >
> > </dependencies>
> > <build>
> > <plugins>
> > <plugin>
> > <artifactId>maven-ejb-plugin</artifactId>
> > <configuration>
> > <archive>
> > <manifest>
> > <addClasspath>true</addClasspath>
> > </manifest>
> > </archive>
> > </configuration>
> > </plugin>
> > <plugin>
> > <artifactId>maven-ejb-plugin</artifactId>
> > <configuration>
> > <archive>
> > <manifest>
> > <addClasspath>true</addClasspath>
> > </manifest>
> > </archive>
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-plugin</artifactId>
> > <executions>
> > <execution>
> > <id>run server side JUnits from tests_Serverside</id>
> > <phase>integration-test</phase>
> > <configuration>
> > <reportFormat>xml</reportFormat>
> > <includes>
> > <include>**/*.java </include>
> > </includes>
> > <testFailureIgnore>false</testFailureIgnore>
> >
> <testClassesDirectory>target/test-classes</testClassesDirectory>
> > <classesDirectory>/target/classes</classesDirectory>
> > </configuration>
> > <goals>
> > <goal>test</goal>
> > </goals>
> > </execution>
> > </executions>
> > </plugin>
> >
> > <!-- <plugin>
> > <groupId>org.testng</groupId>
> > <artifactId>maven-testng-plugin</artifactId>
> > <configuration/>
> > </plugin>-->
> > </plugins>
> > </build>
> > </project>
> >
> >
> >
> > anyone could help?
> >
> > thanks in advance and regards
> > marco
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Maven2 tests
Posted by Wayne Fay <wa...@gmail.com>.
Docs are wrong.
Test files go in:
src/test/java
Where did you see this "test/java" directory reference? It needs to be changed.
Wayne
On 3/7/06, Marco Mistroni <mm...@gmail.com> wrote:
> Hi all,
> i m trying ot use Maven2 in my project,.....
>
> structure of my dir is
>
> <mydir>
> |__src
> |____main
> |___ java
> |___ resources
>
> |___ test
> |__ java
>
>
> i m trying to run some junit tests.
> according to docs ihave read (about maven directory structure), i should
> place
> tests in the test\java directory.. but when i do that, maven-surefire-plugin
> does not find them
>
> it finds them only if i put int he src\main\test directory
>
> what is the correct approach?
>
> this is my current pom.xml
>
> <project>
> <modelVersion>4.0.0</modelVersion>
> <groupId>root</groupId>
> <artifactId>ejbs</artifactId>
> <packaging>ejb</packaging>
> <version>1.0</version>
> <name>enterprise java beans</name>
> <parent>
> <groupId>root</groupId>
> <artifactId>project</artifactId>
> <version>1.0</version>
> </parent>
> <pluginRepositories>
> <pluginRepository>
> <id>apache.snapshots</id>
> <url>http://cvs.apache.org/maven-snapshot-repository</url>
> </pluginRepository>
> </pluginRepositories>
> <repositories>
> <repository>
> <id>apache.snapshots</id>
> <url>http://cvs.apache.org/maven-snapshot-repository</url>
> </repository>
> </repositories>
> <dependencies>
> <dependency>
> <groupId>root</groupId>
> <artifactId>shared</artifactId>
> </dependency>
> <dependency>
> <groupId>geronimo-spec</groupId>
> <artifactId>geronimo-spec-j2ee</artifactId>
> </dependency>
> <dependency>
> <groupId>jboss</groupId>
> <artifactId>jboss-ejb3x</artifactId>
> <version>4.0.3</version>
> <scope>system</scope>
> <systemPath>${basedir}\lib\jboss-ejb3x-4.0.3.jar</systemPath>
> </dependency>
> <dependency>
> <groupId>jboss</groupId>
> <artifactId>ejb3-persistence</artifactId>
> <version>4.0.3</version>
> <scope>system</scope>
> <systemPath>${basedir}\lib\ejb3-persistence-4.0.3.jar</systemPath>
> </dependency>
>
> <dependency>
> <groupId>org.testng</groupId>
> <artifactId>testng</artifactId>
> <version>4.6.1</version>
> <scope>test</scope>
> <classifier>jdk15</classifier>
> </dependency>
>
> </dependencies>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-ejb-plugin</artifactId>
> <configuration>
> <archive>
> <manifest>
> <addClasspath>true</addClasspath>
> </manifest>
> </archive>
> </configuration>
> </plugin>
> <plugin>
> <artifactId>maven-ejb-plugin</artifactId>
> <configuration>
> <archive>
> <manifest>
> <addClasspath>true</addClasspath>
> </manifest>
> </archive>
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <executions>
> <execution>
> <id>run server side JUnits from tests_Serverside</id>
> <phase>integration-test</phase>
> <configuration>
> <reportFormat>xml</reportFormat>
> <includes>
> <include>**/*.java </include>
> </includes>
> <testFailureIgnore>false</testFailureIgnore>
> <testClassesDirectory>target/test-classes</testClassesDirectory>
> <classesDirectory>/target/classes</classesDirectory>
> </configuration>
> <goals>
> <goal>test</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
>
> <!-- <plugin>
> <groupId>org.testng</groupId>
> <artifactId>maven-testng-plugin</artifactId>
> <configuration/>
> </plugin>-->
> </plugins>
> </build>
> </project>
>
>
>
> anyone could help?
>
> thanks in advance and regards
> marco
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven2 tests
Posted by Piéroni Raphaël <ra...@gmail.com>.
Hi Marco,
You have too approach the formal one and the customised one.
In the formal approach, you will move your tests in the default directory
In the customised approach, you will set the testSourceDirectory element of
build to the path of your tests. see [1]
<project>
...
<build>
...
<testSourceDirectory>test/java</testSourceDirectory>
...
</build>
...
</project>
Hope this helps.
Raphaël
[1]:http://maven.apache.org/maven-model/maven.html
2006/3/7, Marco Mistroni <mm...@gmail.com>:
>
> Hi all,
> i m trying ot use Maven2 in my project,.....
>
> structure of my dir is
>
> <mydir>
> |__src
> |____main
> |___ java
> |___ resources
>
> |___ test
> |__ java
>
>
> i m trying to run some junit tests.
> according to docs ihave read (about maven directory structure), i should
> place
> tests in the test\java directory.. but when i do that,
> maven-surefire-plugin
> does not find them
>
> it finds them only if i put int he src\main\test directory
>
> what is the correct approach?
>