使用gradle 4.1运行ant.importBuild时出现IllegalAccessError

时间:2017-08-22 13:21:49

标签: gradle ant

我无法将旧的ant构建脚本导入gradle。

我在导入之前添加了几个ant扩展名:

tbl_user.address_id

失败的代码是:configurations { antdep } dependencies { // ant script dependencies antdep group: 'ant-contrib', name: 'ant-contrib', version: '1.0b3' antdep group: 'org.jacoco', name: 'org.jacoco.ant', version: '0.7.4.201502262128' antdep group: 'org.codehaus.sonar-plugins', name: 'sonar-ant-task', version: '2.2' antdep group: 'org.eclipse.jdt.core.compiler', name: 'ecj', '4.3.1' antdep group: 'com.oopsconsultancy', name: 'xmltask', version: '1.16' ... } def antClassLoader = org.apache.tools.ant.Project.class.classLoader configurations.antdep.each { File f -> antClassLoader.addURL(f.toURI().toURL()) }

我们使用ant-contrib中的ant.importBuild('src/build.xml')覆盖属性,但我不知道如何调试它。

我得到以下stacktrace:

<var />

完整的堆栈跟踪:https://pastebin.com/aPkwKj48

如果我改为删除14:50:20.789 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong: 14:50:20.789 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A problem occurred evaluating project ':utility'. 14:50:20.789 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > java.lang.IllegalAccessError: tried to access class com.google.common.collect.SortedIterables from class com.google.common.collect.ImmutableSortedSet 14:50:20.790 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 14:50:20.790 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is: 14:50:20.791 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.GradleScriptException: A problem occurred evaluating project ':utility'. 14:50:20.791 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92) 14:50:20.791 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:187) 14:50:20.791 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77) 14:50:20.791 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:192) 14:50:20.791 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:61) 14:50:20.791 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) 14:50:20.791 [ERROR] ... skipped, see pastebin for full stacktrace [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82) 14:50:20.795 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 14:50:20.795 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 14:50:20.795 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50) 14:50:20.795 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297) 14:50:20.795 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) 14:50:20.795 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.IllegalAccessError: tried to access class com.google.common.collect.SortedIterables from class com.google.common.collect.ImmutableSortedSet 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.common.cache.LocalCache.get(LocalCache.java:3934) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore.getTaskClassInfo(DefaultTaskClassInfoStore.java:64) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory.process(AnnotationProcessingTaskFactory.java:55) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory.create(AnnotationProcessingTaskFactory.java:51) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory.create(AnnotationProcessingTaskFactory.java:32) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.DependencyAutoWireTaskFactory.create(DependencyAutoWireTaskFactory.java:44) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.DependencyAutoWireTaskFactory.create(DependencyAutoWireTaskFactory.java:27) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.DefaultTaskContainer$TaskInstantiator.create(DefaultTaskContainer.java:301) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.DefaultTaskContainer$TaskInstantiator.create(DefaultTaskContainer.java:289) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:116) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.DefaultAntBuilder.importBuild(DefaultAntBuilder.java:121) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.DefaultAntBuilder.importBuild(DefaultAntBuilder.java:93) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.DefaultAntBuilder$importBuild.call(Unknown Source) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at build_50k7lo2jmk8496neix4cqy0gl.run(C:\epj\work\gradle\UTILITY\build.gradle:32) 14:50:20.796 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90) 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] ... 93 more 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: java.lang.IllegalAccessError: tried to access class com.google.common.collect.SortedIterables from class com.google.common.collect.ImmutableSortedSet 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.common.collect.ImmutableSortedSet.copyOf(ImmutableSortedSet.java:344) 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.common.collect.ImmutableSortedSet.copyOf(ImmutableSortedSet.java:379) 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.common.collect.ImmutableSortedSet.copyOf(ImmutableSortedSet.java:291) 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.TaskClassValidator.<init>(TaskClassValidator.java:38) 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.DefaultTaskClassValidatorExtractor.extractValidator(DefaultTaskClassValidatorExtractor.java:136) 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$1.load(DefaultTaskClassInfoStore.java:51) 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$1.load(DefaultTaskClassInfoStore.java:45) 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) 14:50:20.797 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] ... 111 more ,那么我得到这个堆栈跟踪

ant.importBuild('src/build.xml')

在此处查看完整的堆栈跟踪:https://pastebin.com/GKVSuyML

0 个答案:

没有答案