failure to copy xml resources

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

failure to copy xml resources

Scott_Walton
I'm doing a Griffon (2.12) with the Mybatis plugin. As soon as I create the mapper XML file, the gradle run fails with "unable to copy the file". I'm running on Windows, but I copied the files over to Linux and got the same results. I also tried manually copying the specified file, but, event though it copies successfully, the build still attempts to overlay the file. I using the Gradle wrapper (4.4), but straight Gradle (4.0) also fails. I suspect that two tasks are trying to copy the file and the second fails because the first is not yet complete. The file system shows the new file as zero length. Is this a Griffon problem (perhaps with the Gradle plugin?)? Or with something else?



FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processResources'.
> Could not copy file 'C:\Projects\Railroad\Rail2\RailroadDB\src\main\resources\com\spw\rr\DataMapper.xml' to 'C:\Projec
ts\Railroad\Rail2\RailroadDB\build\resources\main\com\spw\rr\DataMapper.xml'.

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

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processResources'.
> Could not copy file 'C:\Projects\Railroad\Rail2\RailroadDB\src\main\resources\com\spw\rr\DataMapper.xml' to 'C:\Projec
ts\Railroad\Rail2\RailroadDB\build\resources\main\com\spw\rr\DataMapper.xml'.

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

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':processResources'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.
java:100)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70
)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachin
gStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExec
uter.java:88)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactState
TaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.j
ava:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.j
ava:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34
)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.
java:248)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildO
perationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildO
perationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecute
r.java:241)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecute
r.java:230)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor
.java:124)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.
java:80)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.j
ava:105)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.j
ava:99)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99
)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.GradleException: Could not copy file 'C:\Projects\Railroad\Rail2\RailroadDB\src\main\resources
\com\spw\rr\DataMapper.xml' to 'C:\Projects\Railroad\Rail2\RailroadDB\build\resources\main\com\spw\rr\DataMapper.xml'.
        at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:79)
        at org.gradle.api.internal.file.copy.DefaultFileCopyDetails.copyTo(DefaultFileCopyDetails.java:104)
        at org.gradle.api.internal.file.copy.FileCopyAction$FileCopyDetailsInternalAction.processFile(FileCopyAction.jav
a:44)
        at org.gradle.api.internal.file.copy.NormalizingCopyActionDecorator$1$1.processFile(NormalizingCopyActionDecorat
or.java:66)
        at org.gradle.api.internal.file.copy.DuplicateHandlingCopyActionDecorator$1$1.processFile(DuplicateHandlingCopyA
ctionDecorator.java:60)
        at org.gradle.api.internal.file.copy.CopyFileVisitorImpl.processFile(CopyFileVisitorImpl.java:62)
        at org.gradle.api.internal.file.copy.CopyFileVisitorImpl.visitFile(CopyFileVisitorImpl.java:46)
        at org.gradle.api.internal.file.collections.jdk7.Jdk7DirectoryWalker$1.visitFile(Jdk7DirectoryWalker.java:85)
        at org.gradle.api.internal.file.collections.jdk7.Jdk7DirectoryWalker$1.visitFile(Jdk7DirectoryWalker.java:58)
        at org.gradle.api.internal.file.collections.jdk7.Jdk7DirectoryWalker.walkDir(Jdk7DirectoryWalker.java:58)
        at org.gradle.api.internal.file.collections.DirectoryFileTree.walkDir(DirectoryFileTree.java:155)
        at org.gradle.api.internal.file.collections.DirectoryFileTree.visitFrom(DirectoryFileTree.java:133)
        at org.gradle.api.internal.file.collections.DirectoryFileTree.visit(DirectoryFileTree.java:118)
        at org.gradle.api.internal.file.collections.FileTreeAdapter.visit(FileTreeAdapter.java:110)
        at org.gradle.api.internal.file.CompositeFileTree.visit(CompositeFileTree.java:87)
        at org.gradle.api.internal.file.copy.CopySpecActionImpl.execute(CopySpecActionImpl.java:39)
        at org.gradle.api.internal.file.copy.CopySpecActionImpl.execute(CopySpecActionImpl.java:24)
        at org.gradle.api.internal.file.copy.DefaultCopySpec$DefaultCopySpecResolver.walk(DefaultCopySpec.java:648)
        at org.gradle.api.internal.file.copy.DefaultCopySpec$DefaultCopySpecResolver.walk(DefaultCopySpec.java:650)
        at org.gradle.api.internal.file.copy.DefaultCopySpec.walk(DefaultCopySpec.java:458)
        at org.gradle.api.internal.file.copy.DelegatingCopySpecInternal.walk(DelegatingCopySpecInternal.java:236)
        at org.gradle.api.internal.file.copy.CopySpecBackedCopyActionProcessingStream.process(CopySpecBackedCopyActionPr
ocessingStream.java:38)
        at org.gradle.api.internal.file.copy.DuplicateHandlingCopyActionDecorator$1.process(DuplicateHandlingCopyActionD
ecorator.java:44)
        at org.gradle.api.internal.file.copy.NormalizingCopyActionDecorator$1.process(NormalizingCopyActionDecorator.jav
a:57)
        at org.gradle.api.internal.file.copy.FileCopyAction.execute(FileCopyAction.java:35)
        at org.gradle.api.internal.file.copy.NormalizingCopyActionDecorator.execute(NormalizingCopyActionDecorator.java:
53)
        at org.gradle.api.internal.file.copy.DuplicateHandlingCopyActionDecorator.execute(DuplicateHandlingCopyActionDec
orator.java:42)
        at org.gradle.api.internal.file.copy.CopyActionExecuter.execute(CopyActionExecuter.java:40)
        at org.gradle.api.tasks.AbstractCopyTask.copy(AbstractCopyTask.java:174)
        at org.gradle.language.jvm.tasks.ProcessResources.copy(ProcessResources.java:35)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTas
kClassInfoStore.java:141)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskC
lassInfoStore.java:134)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskC
lassInfoStore.java:121)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:731)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:705)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)

        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildO
perationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildO
perationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.j
ava:111)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.
java:92)
        ... 27 more
Caused by: groovy.lang.MissingPropertyException: No such property: refType for class: SimpleTemplateScript2
        at SimpleTemplateScript2.run(SimpleTemplateScript2.groovy:1)
        at org.gradle.api.internal.file.copy.FilterChain$3.transform(FilterChain.java:121)
        at org.gradle.api.internal.file.copy.FilterChain$3.transform(FilterChain.java:110)
        at org.gradle.api.internal.ChainingTransformer.transform(ChainingTransformer.java:37)
        at org.gradle.api.internal.file.copy.FilterChain.transform(FilterChain.java:56)
        at org.gradle.api.internal.file.copy.FilterChain.transform(FilterChain.java:64)
        at org.gradle.api.internal.file.copy.DefaultFileCopyDetails.open(DefaultFileCopyDetails.java:88)
        at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:56)
        at org.gradle.api.internal.file.copy.DefaultFileCopyDetails.copyTo(DefaultFileCopyDetails.java:96)
        at org.gradle.api.internal.file.AbstractFileTreeElement.copyFile(AbstractFileTreeElement.java:93)
        at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:74)
        ... 69 more


* Get more help at https://help.gradle.org

BUILD FAILED in 1s
2 actionable tasks: 1 executed, 1 up-to-date
PS C:\Projects\Railroad\Rail2\RailroadDB>

Reply | Threaded
Open this post in threaded view
|

Re: failure to copy xml resources

Scott_Walton
It works as long as I use Maven instead of Gradle
Reply | Threaded
Open this post in threaded view
|

Re: failure to copy xml resources

aalmiray
Administrator
There's a clue buried in the stacktrace:

   Caused by: groovy.lang.MissingPropertyException: No such property: refType for class: SimpleTemplateScript2

This means there's a script that expects a `refType` variable/property to be defined but it's not.
Reply | Threaded
Open this post in threaded view
|

Re: failure to copy xml resources

Scott_Walton
The reference is in the XML that is being copied. When I change the reference to a constant it runs. That means that it is a different kind of bug in Gradle. In a Mybatis mapper, the form #{abc} is parameter that is passed to the Prepared Statement as a parameter. The ${abc} is a reference that is substituted by Mybatis before preparing the statement. In this case I want to pass in the table name as a parameter (I have about 7 tables with the same structure that I want to use the same basic SQL for). I don't think that Gradle should be scanning a resource as a GString. 

On Sun, Dec 31, 2017 at 7:40 PM, aalmiray [via griffon-user] <[hidden email]> wrote:
There's a clue buried in the stacktrace:

   Caused by: groovy.lang.MissingPropertyException: No such property: refType for class: SimpleTemplateScript2

This means there's a script that expects a `refType` variable/property to be defined but it's not.


If you reply to this email, your message will be added to the discussion below:
http://griffon-user.74797.x6.nabble.com/failure-to-copy-xml-resources-tp382p384.html
To unsubscribe from failure to copy xml resources, click here.
NAML



--
Scott Walton
Reply | Threaded
Open this post in threaded view
|

Re: failure to copy xml resources

aalmiray
Administrator
You must escape every usage of `$` that does not denote a variable palceholder. If there's no variable `abc` then the template must use `\${abc}`.  This is not a Gradle thing but rather a Groovy thing due to the rules imposed by StringTemplateEngine and its supported formats.