What is the correct maven groovy gmaven pom configuration?

3.1k views Asked by At

Hello I'm trying to use groovy with java, on java maven project, I think I provided every artifacts and plugins needed to run it well, here is my pom : pom content and here is the exception caught after trying to build I linked it to pastebin cause I enabled -X option to get full stack trace trace

1

There are 1 answers

0
cheroliv On

Finally I found a way to get a pom working with gmaven 1.4, groovy 2.0 and java 7, inspired by this project "primefaces-groovy-cassandra"

here is a simple pom of a war type application :

`<?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 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>office</groupId>
<artifactId>gmOffice</artifactId>
<name>gmOffice</name>
<version>0.0.1</version>
<packaging>war</packaging>

<properties>
    <!-- Configuration -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.7</java.version>

    <!-- Dependencies -->
    <javax.servlet.api.version>3.0.1</javax.servlet.api.version>
    <primefaces.version>3.2</primefaces.version>
    <myfaces.version>2.1.7</myfaces.version>


    <!-- Maven plugins -->
    <maven.compiler.version>2.4</maven.compiler.version>
    <maven.enforcer.version>1.0.1</maven.enforcer.version>
    <maven.war.version>2.2</maven.war.version>
    <maven.gmaven.version>1.4</maven.gmaven.version>
    <netbeans.hint.deploy.server>Tomcat</netbeans.hint.deploy.server>
    <slf4j.version>1.6.1</slf4j.version>
</properties>

<repositories>
    <repository>
        <id>sonatype-releases</id>
        <name>Sonatype Releases Repository</name>
        <url>http://oss.sonatype.org/content/repositories/releases/</url>
    </repository>
    <repository>
        <id>primefaces-releases</id>
        <name>PrimeFaces Releases Repository</name>
        <url>http://repository.primefaces.org</url>
    </repository>
</repositories>

<prerequisites>
    <maven>3.0.0</maven>
</prerequisites>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>${primefaces.version}</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.0.0</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.19</version>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.3.164</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.2.0.Final</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.1.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
    </dependency>




    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.1.7</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.1.7</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>log4j-over-slf4j</artifactId>
        <version>${slf4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>${slf4j.version}</version>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.version}</version>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
                <showDeprecation>true</showDeprecation>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>${maven.enforcer.version}</version>
            <executions>
                <execution>
                    <id>enforce-versions</id>
                    <goals>
                        <goal>enforce</goal>
                    </goals>
                    <configuration>
                        <rules>
                            <requireMavenVersion>
                                <version>[3.0.0,)</version>
                            </requireMavenVersion>
                            <requireJavaVersion>
                                <version>[1.6.0,)</version>
                            </requireJavaVersion>
                        </rules>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.gmaven</groupId>
            <artifactId>gmaven-plugin</artifactId>
            <version>${maven.gmaven.version}</version>
            <configuration>
                <source>src/main/groovy</source>
                <providerSelection>2.0</providerSelection>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-all</artifactId>
                    <version>2.0.0</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <goals>
                        <goal>generateStubs</goal>
                        <goal>compile</goal>
                        <goal>generateTestStubs</goal>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>2.9.1</version>
            <configuration>
                <configLocation>config/sun_checks.xml</configLocation>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>${maven.war.version}</version>
            <configuration>
                <archive>
                    <manifest>
                        <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                    </manifest>
                    <manifestEntries>
                        <Implementation-Version>${project.version}</Implementation-Version>
                        <Implementation-Timestamp>${maven.build.timestamp}</Implementation-Timestamp>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>