Grails / Maven构建失败 [英] Grails/Maven build failure

查看:87
本文介绍了Grails / Maven构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经生成了pom

  grails create-pom 

xml.pom文件

 <?xml version =1.0encoding =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> xxx< / groupId>
< artifactId> xxx< / artifactId>
< packaging> grails-app< / packaging>
< version> 0.1< / version>
< name> xxx< / name>
< description> xxx< / description>

<属性>
< grails.version> 2.2.4< /grails.version>
< / properties>

<依赖关系>

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


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

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


< dependency>
< groupId> org.codehaus.groovy.modules.http-builder< / groupId>
< artifactId> http-builder< / artifactId>
< version> 0.5.0< / version>
< scope>编译< / scope>
<! - ######################################### - >
<排除项>
<排除>
< groupId> xml-resolver< / groupId>
< artifactId> xml-resolver< / artifactId>
< /排除>
< /排除>
< /依赖关系>


< dependency>
< groupId> postgresql< / groupId>
< artifactId> postgresql< / artifactId>
< version> 9.3-1101.jdbc41< / version>
< scope>运行时< / scope>

< / dependency>


< dependency>
< groupId> commons-net< / groupId>
< artifactId> commons-net< / artifactId>
< version> 3.0< / version>
< scope>运行时< / scope>

< / dependency>


< dependency>
< groupId> org.spockframework< / groupId>
< artifactId> spock-grails-support< / artifactId>
< version> 0.7-groovy-2.0< / version>
< scope> test< / scope>

< / dependency>


< dependency>
< groupId> org.grails.plugins< / groupId>
< artifactId> tomcat< / artifactId>
< version> $ {grails.version}< / version>
< scope>提供< / scope>
< type> zip< / type>
< /依赖关系>

< dependency>
< groupId> org.grails.plugins< / groupId>
< artifactId>邮件< / artifactId>
< version> 1.0.4< / version>
< scope>编译< / scope>
< type> zip< / type>
< /依赖关系>


< dependency>
< groupId> org.grails.plugins< / groupId>
< artifactId>石英< / artifactId>
< version> 1.0-RC11< / version>
< scope>编译< / scope>
< type> zip< / type>
< /依赖关系>


< dependency>
< groupId> org.grails.plugins< / groupId>
< artifactId> gflyway2< / artifactId>
< version> 0.4.1< / version>
< scope>编译< / scope>
< type> zip< / type>
< /依赖关系>


< dependency>
< groupId> org.grails.plugins< / groupId>
< artifactId>缓存< / artifactId>
< version> 1.0.1< / version>
< scope>编译< / scope>
< type> zip< / type>
< /依赖关系>


< dependency>
< groupId> org.grails.plugins< / groupId>
< artifactId> jquery< / artifactId>
< version> 1.8.3< / version>
< scope>运行时< / scope>
< type> zip< / type>
< /依赖关系>


< dependency>
< groupId> org.grails.plugins< / groupId>
< artifactId>数据库迁移< / artifactId>
< version> 1.3.2< / version>
< scope>运行时< / scope>
< type> zip< / type>
< /依赖关系>


< dependency>
< groupId> org.grails.plugins< / groupId>
< artifactId> hibernate< / artifactId>
< version> 2.2.4< / version>
< scope>运行时< / scope>
< type> zip< / type>
< /依赖关系>


< dependency>
< groupId> org.grails.plugins< / groupId>
< artifactId> spock< / artifactId>
< version> 0.7< / version>
< scope> test< / scope>
< type> zip< / type>
< /依赖关系>


< dependency>
< groupId> org.grails.plugins< / groupId>
< artifactId> tomcat< / artifactId>
< version> 2.2.4< / version>
< scope>提供< / scope>
< type> zip< / type>
< /依赖关系>

< dependency>
< groupId> org.postgresql< / groupId>
< artifactId> postgresql< / artifactId>
< version> 9.3-1101-jdbc41< / version>
< /依赖关系>

< /依赖关系>

< build>
< pluginManagement />

< plugins>
<! - 为Grails应用程序禁用Maven surefire插件,因为我们有我们自己的测试运行器 - >
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-surefire-plugin< / artifactId>
<配置>
< skip> true< / skip>
< / configuration>
<执行次数>
<执行>
< id> surefire-it< / id>
<阶段>整合测试< /阶段>
<目标>
< goal> test< / goal>
< /目标>
<配置>
< skip> false< / skip>
< / configuration>
< /执行>
< /执行次数>
< / plugin>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-clean-plugin< / artifactId>
< version> 2.4.1< / version>
<配置>
<档案集>
< fileset>
<目录>插件< /目录>
<包括>
< include> ** / *< / include>
< / includes>
< followSymlinks> false< / followSymlinks>
< / fileset>
< / filesets>
< / configuration>
< / plugin>

< plugin>
< groupId> org.grails< / groupId>
< artifactId> grails-maven-plugin< / artifactId>
< version> $ {grails.version}< / version>
<配置>
<! - 是否为Fork运行Grails命令的JVM - >
< fork> true< / fork>
< / configuration>
< extensions> true< / extensions>
< / plugin>
< / plugins>
< / build>

< repositories>
< repository>
< id> Codehaus< / id>
< url> http://repository.codehaus.org< / url>
< / repository>
< repository>
< id> grails< / id>
<名称> grails< /名称>
< url> http://repo.grails.org/grails/core< / url>
< / repository>
< repository>
< id> grails-plugins< / id>
<名称> grails-plugins< / name>
< url> http://repo.grails.org/grails/plugins< / url>
< / repository>

<! - - >
< repository>
< id> clojars< / id>
< url> http://clojars.org/repo/< / url>
< / repository>
< repository>
< id> Codehaus.Snapshots< / id>
< url> http://snapshots.repository.codehaus.org< / url>
<快照><启用> true< / enabled>< / snapshots>
< / repository>
<! - - >
< / repositories>

<个人资料>
<个人资料>
< id>工具< / id>
<激活>
<属性>
< name> java.vendor< / name>
<值> Sun Microsystems Inc.< /值>
< / property>
< / activation>
<依赖关系>
< dependency>
< groupId> com.sun< / groupId>
< artifactId>工具< / artifactId>
< version> $ {java.version}< / version>
< scope>系统< / scope>
< systemPath> $ {java.home} /../ lib / tools.jar< / systemPath>
< /依赖关系>
< /依赖关系>
< / profile>
< / profiles>
< / project>

构建给出以下例外:

<$加载Grails 2.2.4
|配置类路径

致命错误分叉Grails JVM:java.lang.reflect.InvocationTargetException
java。 lang.RuntimeException:java.lang.reflect.InvocationTargetException
at org.grails.launcher.GrailsLauncher.launch(GrailsLauncher.java:150)
at org.grails.maven.plugin.tools.ForkedGrailsRuntime.main (ForkedGrailsRuntime.java:168)
导致:java.lang.reflect.InvocationTargetException $ b $在sun.reflect.NativeMethodAccessorImpl.invoke0(本地方法)
at sun.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
在org.grails.launcher.GrailsLauncher.launch(GrailsLauncher.java:144)
... 1 m ore
导致:java.lang.LinkageError:加载器约束违规:解析重写方法时org.apache.tools.ant.helper.ProjectHelper2 $ RootHandler.setDocumentLocator(Lorg / xml / sax / Locator;)V当前类的类加载器(org / grails / launcher / RootLoader的实例)
org / apache / tools / ant / helper / ProjectHelper2 $ RootHandler及其超类加载器(< bootloader>的实例)在org.apache.tools.ant.helper的签名
中使用的类型为he.tools.ant.helper.ProjectHelper2 $ RootHandler.setDocumentLocator(Lorg / xml / sax / Locator;)V的类有不同的Class对象。 ProjectHelper2.parseUnknownElement(ProjectHelper2.java:131)
at org.apache.tools.ant.helper.ProjectHelper2.parseAntlibDescriptor(ProjectHelper2.java:111)
at org.apache.tools.ant.taskdefs。 Antlib.createAntlib(Antlib.java:91)
at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:440)
at org.apache.tools.ant.taskdefs。 Definer.execu te(Definer.java:292)
at org.apache.tools.ant.ComponentHelper.checkNamespace(ComponentHelper.java:869)
at org.apache.tools.ant.ComponentHelper.getDefinition(ComponentHelper。 java:308)
at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:285)
at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:264)
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:417)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
在groovy.util.AntBuilder.performTask(AntBuilder.java:255)
在groovy.util.AntBuilder.nodeCompleted(AntBuilder.java:220)
在groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java :147)
at groovy.util.AntBuilder.doInvokeMethod(AntBuilder.java:170)
at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:64)
at org.codehaus。 gant.Gant Builder.invokeMethod(GantBuilder.java:99)
在org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
在org.codehaus.groovy.runtime.callsite。 CallSiteArray.defaultCall(CallSiteArray.java:45)
在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
在org.codehaus.groovy.runtime.callsite。 AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.gant.GantBinding.initializeGantBinding(GantBinding.groovy:108)
at org.codehaus.gant.GantBinding。< init>(GantBinding .groovy:42)
at org.codehaus.groovy.grails.cli.GrailsS​​criptRunner.executeScriptWithCaching(GrailsS​​criptRunner.java:424)
at org.codehaus.groovy.grails.cli.GrailsS​​criptRunner.callPluginOrGrailsS​​cript(GrailsS​​criptRunner .java:410)
在org.codehaus.groovy.grails.cli.GrailsS​​criptRunner.executeCommand(GrailsS​​criptRunner.java:374)
在org.codeh aus.groovy.grails.cli.GrailsS​​criptRunner.executeCommand(GrailsS​​criptRunner.java:339)
... 6 more
[INFO] ---------------- -------------------------------------------------- ------
[INFO] BUILD FAILURE
[INFO] ---------------------------- --------------------------------------------
[INFO ]总时间:10.351 s
[信息]完成时间:2014-05-23T12:47:31 + 01:00
[信息] Final Memory:10M / 27M
[信息] - -------------------------------------------------- ---------------------
[错误]无法执行目标org.grails:grails-maven-plugin:2.2.4:clean(default-干净)在项目XXX:分叉Grails虚拟机退出错误 - > [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException:无法执行目标org.grails:grails-maven-plugin:2.2.4:项目XXX上的clean(默认干净):分叉的Grails VM退出错误
在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java: 108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build( SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.mav en.DefaultMaven.doExecute(DefaultMaven.java:361)
在org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
在org.apache.maven.cli.MavenCli.execute( MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:43)
在java.lang.reflect.Method.invoke(Method.java:606)
在org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java: 289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java: 415)
在org.codehaus .plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
导致:org.apache.maven.plugin.MojoExecutionException:分叉的Grails虚拟机退出,错误
,位于org.grails.maven .plugin.AbstractGrailsMojo.runGrails(AbstractGrailsMojo.java:388)
at org.grails.maven.plugin.AbstractGrailsMojo.runGrails(AbstractGrailsMojo.java:308)
at org.grails.maven.plugin.GrailsCleanMojo .execute(GrailsCleanMojo.java:35)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
... 19 more
导致:java.lang.RuntimeException:在org.grails.maven.plugin.tools处退出错误
的分叉Grails虚拟机。 ForkedGrailsRuntime.fork(ForkedGrailsRuntime.java:117)
at org.grails.maven.plugin.AbstractGrailsMojo.runGrails(AbstractGrailsMojo.java:386)
... 23 more
[错误]
[错误]
[错误]有关错误和可能的解决方案的更多信息,请阅读以下文章:
[错误] [帮助1] http://cwiki.apache.org/confluence/显示/ MAVEN / MojoExecutionException

请帮助我吗?

D:\dev> java -version
java版本1.7.0_25
Java™SE运行时环境(build 1.7.0_25-b17)
Java HotSpot™64位服务器虚拟机(构建23.25-b01,混合模式)

D:\dev> grails -version

Grails版本:2.2.4

D:\dev> mvn --version
Apache Maven 3.2.1(ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52 + 01:00)
Maven home:C:\ apache-maven-3.2.1\bin ..
Java版本:1.7.0_45,供应商: Oracle Corporation
Java主页:C:\glassfish4\jdk7\jre
默认语言环境:en_US,平台编码:Cp1250
操作系统名称:windows 7,版本:6.1 ,arch:x86,family:windows



谢谢!

解决方案

我相信你需要在你的 http-builder 依赖关系中添加 xml-apis 的排除。 / p>

 < dependency> 
< groupId> org.codehaus.groovy.modules.http-builder< / groupId>
< artifactId> http-builder< / artifactId>
< version> 0.5.0< / version>
< scope>编译< / scope>
<! - ######################################### - >
<排除项>
<排除>
< groupId> xml-resolver< / groupId>
< artifactId> xml-resolver< / artifactId>
< /排除>
<排除>
< groupId> xml-apis< / groupId>
< artifactId> xml-apis< / artifactId>
< /排除>
< /排除>
< /依赖关系>


I've generated pom by

grails create-pom

The xml.pom file

<?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>xxx</groupId>
    <artifactId>xxx</artifactId>
    <packaging>grails-app</packaging>
    <version>0.1</version>
    <name>xxx</name>
    <description>xxx</description>

    <properties>
        <grails.version>2.2.4</grails.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>org.codehaus.groovy.modules.http-builder</groupId>
        <artifactId>http-builder</artifactId>
        <version>0.5.0</version>
        <scope>compile</scope>
        <!-- ######################################### -->
        <exclusions>
            <exclusion>
                <groupId>xml-resolver</groupId>
                <artifactId>xml-resolver</artifactId>
            </exclusion>
      </exclusions>
    </dependency>


    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.3-1101.jdbc41</version>
        <scope>runtime</scope>

    </dependency>


    <dependency>
        <groupId>commons-net</groupId>
        <artifactId>commons-net</artifactId>
        <version>3.0</version>
        <scope>runtime</scope>

    </dependency>


    <dependency>
        <groupId>org.spockframework</groupId>
        <artifactId>spock-grails-support</artifactId>
        <version>0.7-groovy-2.0</version>
        <scope>test</scope>

    </dependency>


        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>tomcat</artifactId>
            <version>${grails.version}</version>
            <scope>provided</scope>
            <type>zip</type>
        </dependency>

    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>mail</artifactId>
        <version>1.0.4</version>
        <scope>compile</scope>
        <type>zip</type>
    </dependency>


    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>quartz</artifactId>
        <version>1.0-RC11</version>
        <scope>compile</scope>
        <type>zip</type>
    </dependency>


    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>gflyway2</artifactId>
        <version>0.4.1</version>
        <scope>compile</scope>
        <type>zip</type>
    </dependency>


    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>cache</artifactId>
        <version>1.0.1</version>
        <scope>compile</scope>
        <type>zip</type>
    </dependency>


    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>jquery</artifactId>
        <version>1.8.3</version>
        <scope>runtime</scope>
        <type>zip</type>
    </dependency>


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


    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>hibernate</artifactId>
        <version>2.2.4</version>
        <scope>runtime</scope>
        <type>zip</type>
    </dependency>


    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>spock</artifactId>
        <version>0.7</version>
        <scope>test</scope>
        <type>zip</type>
    </dependency>


    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>tomcat</artifactId>
        <version>2.2.4</version>
        <scope>provided</scope>
        <type>zip</type>
    </dependency>

    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>9.3-1101-jdbc41</version>
    </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>${grails.version}</version>
                <configuration>
                    <!-- Whether for Fork a JVM to run Grails commands -->
                    <fork>true</fork>
                </configuration>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

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

        <!--   -->
        <repository>
            <id>clojars</id>
            <url>http://clojars.org/repo/</url>
        </repository>
        <repository>
          <id>Codehaus.Snapshots</id>
          <url>http://snapshots.repository.codehaus.org</url>
          <snapshots><enabled>true</enabled></snapshots>
        </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>

The build gives the following exception:

|Loading Grails 2.2.4
|Configuring classpath

Fatal error forking Grails JVM: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.grails.launcher.GrailsLauncher.launch(GrailsLauncher.java:150)
        at org.grails.maven.plugin.tools.ForkedGrailsRuntime.main(ForkedGrailsRuntime.java:168)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.grails.launcher.GrailsLauncher.launch(GrailsLauncher.java:144)
        ... 1 more
Caused by: java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.apache.tools.ant.helper.ProjectHelper2$RootHandler.setDocumentLocator(Lorg/xml/sax/Locator;)V" the class loader (instance of org/grails/launcher/RootLoader) of the current class,
 org/apache/tools/ant/helper/ProjectHelper2$RootHandler, and its superclass loader (instance of <bootloader>), have different Class objects for the type he.tools.ant.helper.ProjectHelper2$RootHandler.setDocumentLocator(Lorg/xml/sax/Locator;)V used in the signature
        at org.apache.tools.ant.helper.ProjectHelper2.parseUnknownElement(ProjectHelper2.java:131)
        at org.apache.tools.ant.helper.ProjectHelper2.parseAntlibDescriptor(ProjectHelper2.java:111)
        at org.apache.tools.ant.taskdefs.Antlib.createAntlib(Antlib.java:91)
        at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:440)
        at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:292)
        at org.apache.tools.ant.ComponentHelper.checkNamespace(ComponentHelper.java:869)
        at org.apache.tools.ant.ComponentHelper.getDefinition(ComponentHelper.java:308)
        at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:285)
        at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:264)
        at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:417)
        at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
        at groovy.util.AntBuilder.performTask(AntBuilder.java:255)
        at groovy.util.AntBuilder.nodeCompleted(AntBuilder.java:220)
        at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:147)
        at groovy.util.AntBuilder.doInvokeMethod(AntBuilder.java:170)
        at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:64)
        at org.codehaus.gant.GantBuilder.invokeMethod(GantBuilder.java:99)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at org.codehaus.gant.GantBinding.initializeGantBinding(GantBinding.groovy:108)
        at org.codehaus.gant.GantBinding.<init>(GantBinding.groovy:42)
        at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching(GrailsScriptRunner.java:424)
        at org.codehaus.groovy.grails.cli.GrailsScriptRunner.callPluginOrGrailsScript(GrailsScriptRunner.java:410)
        at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:374)
        at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:339)
        ... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.351 s
[INFO] Finished at: 2014-05-23T12:47:31+01:00
[INFO] Final Memory: 10M/27M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.2.4:clean (default-clean) on project XXX: Forked Grails VM exited with error -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.grails:grails-maven-plugin:2.2.4:clean (default-clean) on project XXX: Forked Grails VM exited with error
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Forked Grails VM exited with error
        at org.grails.maven.plugin.AbstractGrailsMojo.runGrails(AbstractGrailsMojo.java:388)
        at org.grails.maven.plugin.AbstractGrailsMojo.runGrails(AbstractGrailsMojo.java:308)
        at org.grails.maven.plugin.GrailsCleanMojo.execute(GrailsCleanMojo.java:35)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 19 more
Caused by: java.lang.RuntimeException: Forked Grails VM exited with error
        at org.grails.maven.plugin.tools.ForkedGrailsRuntime.fork(ForkedGrailsRuntime.java:117)
        at org.grails.maven.plugin.AbstractGrailsMojo.runGrails(AbstractGrailsMojo.java:386)
        ... 23 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Please, could you help me?

D:\dev>java -version java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

D:\dev>grails -version

Grails version: 2.2.4

D:\dev>mvn --version Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00) Maven home: C:\apache-maven-3.2.1\bin.. Java version: 1.7.0_45, vendor: Oracle Corporation Java home: C:\glassfish4\jdk7\jre Default locale: en_US, platform encoding: Cp1250 OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

Thanks!

解决方案

I believe you need to add the exclusion of xml-apis to your http-builder dependency.

<dependency>
        <groupId>org.codehaus.groovy.modules.http-builder</groupId>
        <artifactId>http-builder</artifactId>
        <version>0.5.0</version>
        <scope>compile</scope>
        <!-- ######################################### -->
        <exclusions>
            <exclusion>
                <groupId>xml-resolver</groupId>
                <artifactId>xml-resolver</artifactId>
            </exclusion>
            <exclusion>
                <groupId>xml-apis</groupId>
                <artifactId>xml-apis</artifactId>
            </exclusion>
      </exclusions>
    </dependency>

这篇关于Grails / Maven构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆