简体   繁体   中英

Grails 2.5.0 Maven Build Issues

I'm trying to build a new Grails 2.5.0 application using Maven, but keep getting errors relating to the grails-maven-plugin.

    [ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.4.4:clean (defau
lt-clean) on project grails_2.5.0_test: Execution default-clean of goal org.grai
ls:grails-maven-plugin:2.4.4:clean failed: java.lang.reflect.InvocationTargetExc
eption: org.codehaus.groovy.runtime.DefaultGroovyMethods.each(Ljava/util/Collect
ion;Lgroovy/lang/Closure;)Ljava/util/Collection; -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.grails:grails-maven-plugin:2.4.4:clean (default-clean) on project grails_2.5.
0_test: Execution default-clean of goal org.grails:grails-maven-plugin:2.4.4:cle
an failed: java.lang.reflect.InvocationTargetException
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:224)

Steps to reproduce:

  1. grails create-app test
  2. grails create-pom test
  3. Updated the maven-clean-plugin dependency from 2.4.0 to 2.4.1 in pom.xml
  4. mvn clean install

I'm running this on JDK 1.7.

The same example works fine with Grails 2.4.4. Am I missing something or is this a bug in 2.5.0?

POM.XML

<?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>test</groupId>
    <artifactId>grails_2.5.0_test</artifactId>
    <packaging>grails-app</packaging>
    <version>0.1</version>

    <name>grails_2.5.0_test</name>
    <description>grails_2.5.0_test</description>

    <properties>
        <grails.version>2.5.0</grails.version>
        <h2.version>1.3.170</h2.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.grails</groupId>
            <artifactId>grails-dependencies</artifactId>
            <version>${grails.version}</version>
            <type>pom</type>
        </dependency>


        <dependency>
            <groupId>org.grails</groupId>
            <artifactId>grails-test</artifactId>
            <version>${grails.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.grails</groupId>
            <artifactId>grails-plugin-testing</artifactId>
            <version>${grails.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-core</artifactId>
            <version>1.0-groovy-2.4</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>${h2.version}</version>
            <scope>runtime</scope>
        </dependency>


        <dependency>
            <groupId>org.grails</groupId>
            <artifactId>grails-datastore-test-support</artifactId>
            <version>1.0.2-grails-2.4</version>
            <scope>test</scope>


        </dependency>


        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>scaffolding</artifactId>
            <version>2.1.2</version>
            <scope>compile</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>cache</artifactId>
            <version>1.1.8</version>
            <scope>compile</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>asset-pipeline</artifactId>
            <version>2.1.5</version>
            <scope>compile</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>hibernate4</artifactId>
            <version>4.3.8.1</version>
            <scope>runtime</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>database-migration</artifactId>
            <version>1.4.0</version>
            <scope>runtime</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>jquery</artifactId>
            <version>1.11.1</version>
            <scope>runtime</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>tomcat</artifactId>
            <version>7.0.55.2</version>
            <scope>provided</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>webxml</artifactId>
            <version>1.4.1</version>
            <type>zip</type>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement/>

        <plugins>
            <!-- Disables the Maven surefire plugin for Grails applications, as we have our own test runner -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>surefire-it</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>plugins</directory>
                            <includes>
                                <include>**/*</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.grails</groupId>
                <artifactId>grails-maven-plugin</artifactId>
                <version>2.4.4</version>
                <configuration>
                    <grailsVersion>${grails.version}</grailsVersion>
                </configuration>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>grails</id>
            <name>grails</name>
            <url>https://repo.grails.org/grails/core</url>
        </repository>
        <repository>
            <id>grails-plugins</id>
            <name>grails-plugins</name>
            <url>https://repo.grails.org/grails/plugins</url>
        </repository>
    </repositories>

    <profiles>
        <profile>
            <id>tools</id>
            <activation>
                <property>
                    <name>java.vendor</name>
                    <value>Sun Microsystems Inc.</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.sun</groupId>
                    <artifactId>tools</artifactId>
                    <version>${java.version}</version>
                    <scope>system</scope>
                    <systemPath>${java.home}/../lib/tools.jar</systemPath>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>

A new version of the Grails Maven plugin (2.4.6) has been released which fixes this issue. I have tested this and can confirm that issue is resolved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM