Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] How to run groovy tests

I have some unit tests that run fine in eclipse.

I cannot seem to make maven find and run the tests, however. 

After doing some google searching I found

http://matschaffer.com/2008/12/groovy-unit-tests-on-maven-eclipse/  

http://docs.codehaus.org/display/GMAVEN/Building+Groovy+Projects  

I've tried moving my tests to src/test/groovy and experimented with
several other directory configurations and it never seems to find the
tests (eclipse does, but not m2eclipse).

Here is my POM. What am I doing wrong? Is it possible to run my tests
using m2eclipse and not install maven?

Also: is it possible to run Maven3 from m2eclipse? Can m2eclipse coexist
with m3eclipse?

thanks,
Siegfried
Here is my pom.xml

<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
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>Interviews</groupId>
  <artifactId>Interviews</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>interviews program exercises</name>
  <description>Programs written for interviews</description>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.groovy.maven</groupId>
        <artifactId>gmaven-plugin</artifactId>
        <version>1.0</version>
        <executions>
          <execution>
                    <goals>
                        <goal>generateStubs</goal>
                        <goal>compile</goal>
                        <goal>generateTestStubs</goal>
                        <goal>testCompile</goal>
                        <goal>execute</goal>
                    </goals>
            <configuration>
              <debug>true</debug>
              <verbose>true</verbose>
              <stacktrace>true</stacktrace>
              <defaultScriptExtension>.groovy</defaultScriptExtension>
              <sources>
                <fileset>
                  <directory>${pom.basedir}/src/test/groovy</directory>
                  <includes>
                    <include>**/*.groovy</include>
                  </includes>
                </fileset>
              </sources>              
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>com.googlecode.sli4j</groupId>
        <artifactId>sli4j-slf4j-log4j</artifactId>
        <version>2.0</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.codehaus.groovy.maven.runtime</groupId>
        <artifactId>gmaven-runtime-1.6</artifactId>
        <version>1.0</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
  </dependencies>
</project>




Back to the top