什么是正确的maven groovy gmaven pom配置



你好,我正在尝试将groovy与java结合使用,在javamaven项目上,我认为我提供了运行它所需的所有工件和插件,这是我的pom:pom含量以下是在尝试构建后捕获的异常我把它链接到pastebin,因为我启用了-X选项来获得全栈跟踪

最后,我找到了一种方法,让pom与gmaven 1.4、groovy 2.0和java 7一起工作,灵感来自这个项目"primefaces groovy cassandra"

这是一个战争型应用程序的简单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 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>

最新更新