gpt4 book ai didi

grails - gradle多项目构建为grails-无法组装具有休眠依赖项的项目

转载 作者:行者123 更新时间:2023-12-02 14:42:37 25 4
gpt4 key购买 nike

我已经为grails项目构建了一个多项目gradle构建,并且-当我添加hibernate4依赖项时出现了一个奇怪的错误-

没有这个,项目 build 很好-我可以在路线项目上使用grails组装任务-工作正常,然后运行和连接。

但是,一旦我添加了hibernate4依赖项并尝试组装我就得到了

[sts] -----------------------------------------------------
[sts] Starting Gradle build for the following tasks:
[sts] assemble
[sts] -----------------------------------------------------
:MyItilApp:war
|Loading Grails 2.4.4
|Configuring classpath
Error |
Fatal error forking Grails JVM: null
Error |
java.lang.reflect.InvocationTargetException
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Error |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error |
at java.lang.reflect.Method.invoke(Method.java:606)
Error |
at org.grails.launcher.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:57)
Error |
at org.grails.launcher.context.DelegatingGrailsLaunchContext.launch(DelegatingGrailsLaunchContext.java:409)
Error |
at org.grails.launcher.ReflectiveGrailsLauncher.launch(ReflectiveGrailsLauncher.java:32)
Error |
at org.grails.launcher.InProcessGrailsLauncher.launch(InProcessGrailsLauncher.java:27)
Error |
at org.grails.launcher.Main.run(Main.java:62)
Error |
at org.grails.launcher.Main.main(Main.java:38)
Error |
**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/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 andler.setDocumentLocator(Lorg/xml/sax/Locator;)V used in the signature
Error |
at org.apache.tools.ant.helper.ProjectHelper2.parseUnknownElement(ProjectHelper2.java:131)
Error |
at org.apache.tools.ant.helper.ProjectHelper2.parseAntlibDescriptor(ProjectHelper2.java:111)
Error |
at org.apache.tools.ant.taskdefs.Antlib.createAntlib(Antlib.java:91)
Error |
at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:440)
Error |
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:292)
Error |
at org.apache.tools.ant.ComponentHelper.checkNamespace(ComponentHelper.java:877)
Error |
at org.apache.tools.ant.ComponentHelper.getDefinition(ComponentHelper.java:308)
Error |
at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:285)
Error |
at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:264)
Error |
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:417)
Error |
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
Error |
at groovy.util.AntBuilder.performTask(AntBuilder.java:314)
Error |
at groovy.util.AntBuilder.nodeCompleted(AntBuilder.java:264)
Error |
at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:147)
Error |
at groovy.util.AntBuilder.doInvokeMethod(AntBuilder.java:203)
Error |
at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:64)
Error |
at org.codehaus.gant.GantBuilder.invokeMethod(GantBuilder.java:99)
Error |
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
Error |
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
Error |
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
Error |
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
Error |
at org.codehaus.gant.GantBinding.initializeGantBinding(GantBinding.groovy:108)
Error |
at org.codehaus.gant.GantBinding.<init>(GantBinding.groovy:42)
Error |
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching(GrailsScriptRunner.java:430)
Error |
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.callPluginOrGrailsScript(GrailsScriptRunner.java:416)
Error |
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:380)
Error |
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:347)
Error |
... 10 more
:MyItilApp:war FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':MyItilApp:war'.
> Process 'command 'C:\Program Files\Java\jdk1.7.0_51\bin\java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 11.931 secs
[sts] Build failed
org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.1-bin.zip'.
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:53)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.

这是我的顶级build.gradle文件(尝试通过hibernate-core下载并出现相同的问题
import org.grails.gradle.plugin.tasks.GrailsTask


buildscript {
repositories {
maven {url "http://repo.grails.org/grails/core"}
}

dependencies {
classpath "org.grails:grails-gradle-plugin:2.1.1"
}
}

subprojects {


//if grails-app is in subproject apply the grails-app plugin to that project
if (project.file ("grails-app").exists()) {
apply plugin: 'grails'

repositories {
grails.central()
mavenCentral()
}

dependencies {
runtime "org.grails.plugins:tomcat:8.0.14.1" // No container is deployed by default, so add this
//compile 'org.grails.plugins:resources:1.2.13' // deprecated for asset-plugin
compile "org.grails.plugins:asset-pipeline:1.9.9"
compile "org.grails.plugins:scaffolding:2.1.2"
compile "org.grails.plugins:hibernate4:4.3.6.1" //add hibernate
//compile "org.hibernate:hibernate-core:4.3.7.Final" //add hibernate
compile "org.grails.plugins:database-migration:1.4.0"
compile 'org.grails.plugins:cache:1.1.8' //, "org.grails.plugins:cache-ehcache:1.0.4"

runtime "org.grails.plugins:jquery:1.11.1"

/*


compile 'org.grails.plugins:webxml:1.4.1'
*/

//testCompile 'junit:junit:4.8.2'
// testCompile group: 'junit', name: 'junit', version: '4.+'
}

//grails class added by the grails plugin - set its properties
grails {
grailsVersion = '2.4.4'
groovyVersion = '2.3.7'
springLoadedVersion '1.2.1'
}

//make sure we have enough build space
tasks.withType (org.grails.gradle.plugin.tasks.GrailsTask) {Task t ->
t.jvmOptions {
jvmArgs "-Xms512m", "-Xmx4g", "-XX:MaxPermSize=512m"
}
}
}
else {
apply plugin: 'groovy'
}

apply plugin: 'eclipse'


group = 'com.softwood'
version = '0.1-SNAPSHOT'

/*
jar {
manifest.attributes provider: 'my cool company'
}
*/
}

任何人都知道这是什么以及我该如何解决-我现在已经很接近了,但是似乎有了休眠的构建。感谢任何见解和修复

最佳答案

This answer指示需要排除“xml-apis”。还将范围更改为runtime:

runtime('org.grails.plugins:hibernate4:4.3.6.1') {
exclude module: 'xml-apis'
}

关于grails - gradle多项目构建为grails-无法组装具有休眠依赖项的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26834069/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com