maven - Grails 2.5.0 Maven构建问题

标签 maven grails

我正在尝试使用Maven构建新的Grails 2.5.0应用程序,但始终会收到与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)

重现步骤:
  • grails创建应用测试
  • grails创建pom测试
  • 将pom.xml中的maven-clean-plugin依赖关系从2.4.0更新为2.4.1
  • mvn全新安装

  • 我在JDK 1.7上运行它。

    相同的示例适用于Grails 2.4.4。我是否缺少某些东西,或者这是2.5.0中的错误?

    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>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>
    

    最佳答案

    已发布新版本的Grails Maven插件(2.4.6),可以解决此问题。我已经对此进行了测试,可以确认问题已解决。

    关于maven - Grails 2.5.0 Maven构建问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30521113/

    相关文章:

    hibernate - Grails 事务 : duplicate data where there shouldn't be any

    grails - 如何在不导致 StackOverflowError 的情况下覆盖子类中的 setter?

    grails - 如何在更改数据表外部的复选框时更新服务器端数据表

    由于 java.net.UnknownHostException,Maven 元数据插件无法获取 maven-metadata.xml

    scala - OSGi Karaf Scala UnsupportedAudioFileException

    grails - Grails 3.1.16拦截器未过滤方法

    grails - 在 Grails Controller 中重用 Criteria

    java - 如何使用 Spring Boot 应用程序渲染 JSP

    SVN 作为 Maven 仓库

    java - 在 java maven 测试之前运行 python 脚本