Is it possible to comment a line in the sourcecode? I would like to comment some lines in persistence.xml.... or delete is also good!


(Christian Soth) #1

Is it possible to comment a line in the sourcecode? I would like to comment some lines in persistence.xml… or delete is also good!


(René Groeschke) #2

Hi Christian, one way to modify your persistence.xml file is using the features provided by the copy api. Where is your persistence.xml located. is it stored along your sources. Usually all resource files can be manipulated during the processResources task introduced by the java plugin. Have a look at the DSL reference for further details about manipulating resource files during copy operation: http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.Copy.html


(Christian Soth) #3

Thank u Rene,

yes the persistence.xml ist located in src/META-INF/ i will give it a try. But it would be cool if gradle has a manipulating task for this stuff. Like search in a file for a identifier and replace or delete a line :slight_smile:


(René Groeschke) #4

hmm. not sure about this would be a good idea.

Usually those files are under version control. In your normal build workflow it is considered to be best practice not to change the files you have under version control and put everything that is produced into a dedicated directory (build directory in gradle). If you manipulate the file directly in src/META-INF your working copy is always dirty after the build is completed.