A project I am working on uses EclipseLink and the build performs static weaving on compiled classes. The idiom we employ looks like the snippet in this answer on Stack Overflow. This works fine up till Gradle 4.1. Once we upgrade the wrapper to 4.2.1, however, the weaving fails with the following error:
:compileJavaException in thread "main" Local Exception Stack:
Exception [EclipseLink-40007] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.StaticWeaveException
Exception Description: An exception was thrown while weaving: [Ljava.lang.String;@34c45dca
Internal Exception: Exception [EclipseLink-40002] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.StaticWeaveException
Exception Description: No source was specified for weaving
at org.eclipse.persistence.exceptions.StaticWeaveException.exceptionPerformWeaving(StaticWeaveException.java:138)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeave.main(StaticWeave.java:86)
Caused by: Exception [EclipseLink-40002] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.StaticWeaveException
Exception Description: No source was specified for weaving
at org.eclipse.persistence.exceptions.StaticWeaveException.missingSource(StaticWeaveException.java:89)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveProcessor.preProcess(StaticWeaveProcessor.java:190)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveProcessor.performWeaving(StaticWeaveProcessor.java:172)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeave.start(StaticWeave.java:115)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeave.main(StaticWeave.java:84)
FAILED
Running the build with --info gave me some more information and I saw that org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter was deleting the directory containing the output of the compiler, before the weaving began. This explained why the weaver could not find any source files.
I found this issue, which led me this commit via the linked pull request.
I was able to reproduce this problem with a simple standalone project.
Is this an expected change in behavior across minor releases or is this a bug?
