[1.5-rc-1] CoD in Eclipse and IntelliJ


(Ben Manes) #1

I tried turning on CoD with the following results,

=== Eclipse === The import works beautifully, except that generated sources are not detected by eclipse as being part of the sourceSets. This results in a compilation failure.

The jOOQ plugin example should demonstrate this problem. The ‘GenerateJooqTask’ adds to the sourceSets after the projects are evaluated, in order to resolve its configuration property for the target directory. This is run before the compileJava task, so the sources are found by the following build tasks. This works perfectly in Eclipse without CoD enabled.

=== IntellJ === When running ‘gradle idea’ with only CoD or parallel builds enabled, it works. However when I run with both flags enabled then I receive the following error. We run typically parallel builds, e.g. on Jenkins, since its works great for us.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':rest-api-server:ideaModule'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:72)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:49)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
        at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:179)
        at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:232)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:142)
        at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
        at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
        at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:275)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.executeTask(DefaultTaskPlanExecutor.java:52)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.processTask(DefaultTaskPlanExecutor.java:38)
        at org.gradle.execution.taskgraph.ParallelTaskPlanExecutor$TaskExecutorWorker$1.run(ParallelTaskPlanExecutor.java:113)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:112)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:134)
        at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
        at org.gradle.execution.taskgraph.ParallelTaskPlanExecutor$TaskExecutorWorker.executeTaskWithCacheLock(ParallelTaskPlanExecutor.java:110)
        at org.gradle.execution.taskgraph.ParallelTaskPlanExecutor$TaskExecutorWorker.run(ParallelTaskPlanExecutor.java:100)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.gradle.api.GradleException: Cannot parse file '/home/ben/projects/AMP/rest-api-server/rest-api-server.iml'.
       Perhaps this file was tinkered with? In that case try delete this file and then retry.
        at org.gradle.plugins.ide.api.GeneratorTask.generate(GeneratorTask.java:67)
        at sun.reflect.GeneratedMethodAccessor708.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1047)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
        at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)
        at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122)
        at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
        at org.gradle.plugins.ide.idea.GenerateIdeaModule_Decorated.invokeMethod(Unknown Source)
        at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
        at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:161)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:156)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:510)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:499)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:64)
        ... 27 more
Caused by: org.gradle.internal.UncheckedException: org.xml.sax.SAXParseException: Premature end of file.
        at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:39)
        at org.gradle.internal.UncheckedException$throwAsUncheckedException.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at org.gradle.plugins.ide.internal.generator.AbstractPersistableConfigurationObject.load(AbstractPersistableConfigurationObject.groovy:32)
        at org.gradle.plugins.ide.internal.generator.generator.PersistableConfigurationObjectGenerator.read(PersistableConfigurationObjectGenerator.java:31)
        at org.gradle.plugins.ide.internal.generator.generator.PersistableConfigurationObjectGenerator.read(PersistableConfigurationObjectGenerator.java:28)
        at org.gradle.plugins.ide.api.GeneratorTask.generate(GeneratorTask.java:65)
        ... 45 more
Caused by: org.xml.sax.SAXParseException: Premature end of file.
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at groovy.util.XmlParser.parse(XmlParser.java:155)
        at groovy.util.XmlParser$parse$2.call(Unknown Source)
        at org.gradle.plugins.ide.internal.generator.XmlPersistableConfigurationObject.load(XmlPersistableConfigurationObject.groovy:38)
        at org.gradle.plugins.ide.internal.generator.XmlPersistableConfigurationObject$load$0.callCurrent(Unknown Source)
        at org.gradle.plugins.ide.internal.generator.AbstractPersistableConfigurationObject.load(AbstractPersistableConfigurationObject.groovy:27)
        ... 48 more