0

TLDR:

I have a Grails 3 project. The run-app command was working fine. Then I checked it into Perforce. Now run-app fails.


DETAILS:

  • Grails Version: 3.1.1
  • Groovy Version: 2.4.5
  • JVM Version: 1.8.0_91
  • Gradle 2.13

% grails clean

BUILD SUCCESSFUL

% grails run-app

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':processResources'.

    Could not copy file '/Volumes/Neo/singram/work/code/depot/dvdco/webapplications/nightcrawler/grails-app/i18n/messages.properties' to '/Volumes/Neo/singram/work/code/depot/dvdco/webapplications/nightcrawler/build/resources/main/messages.properties'.


GUESS at cause:

Perforce, when a file isn't checked out for editing, will make that file non-writable (chmod a-w). As best I can tell, run-app invokes gradle's processResources which successfully copies the file in question once, then seemingly attempts to copy it again during the same build cycle and fails because thew newly copied file is not writable so it cannot be overwritten with a copy of itself.


WORK-AROUND

The run-app command succeeds if I check out the whole project for editing first. Don't really want to have to do this as it introduces opportunity for error during check-ins.


QUESTION:

Is there a better way than my work-around? Why is gradle's processResources copying the same files more than once? Is there some sort of hook into processResources or run-app that I can use to "chmod -R u+w build" ?

Scott Ingram
  • 85
  • 1
  • 11
  • 1
    Can you exclude the build folder from the Perforce repository? Those files are generated and therefore are not needed in a vcs. – Emmanuel Rosa May 04 '16 at 13:11
  • A couple of options, methinks. Either 1) change the filetype(s) (if Perforce-controlled) to +w to make them writable; or 2) change the workspace spec to include the "allwrite" option to make all files writable. – tkosinski May 04 '16 at 16:31
  • @EmmanuelRosa, good suggestion, but I don't have the build folder in the repository. – Scott Ingram May 06 '16 at 23:14
  • @tkosinski thank you! I didn't know about the "allwrite" option. Fixed my problem. Please enter this as an answer and I will accept it so you can get the points. – Scott Ingram May 06 '16 at 23:16

1 Answers1

1

A couple of options, methinks. Either 1) change the filetype(s) (if Perforce-controlled) to +w to make them writable; or 2) change the workspace spec to include the "allwrite" option to make all files writable. –

tkosinski
  • 1,631
  • 13
  • 17
  • I went with option #2 and that solved my problem, thanks! In the P4 UI, I set the option via workspace tab -> rightclick the workspace -> edit -> advanced -> set "allwrite" option – Scott Ingram May 09 '16 at 18:04