Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep executable permissions on files in a maven archetype

I am building an archetype where I want to include a folder with some executable binaries. The problem is that when I create a new project from the archetype, the executable binaries are created without executable permissions.

How can I tell maven to keep execute permissions on those files ? Or maybe there is a mean to tell maven to add execute permissions automatically at generation time ?

like image 789
baraber Avatar asked Mar 07 '13 14:03

baraber


1 Answers

This question is quite old, but I found myself in the same situation and I found a solution, so here it goes. Here it says that you can write a groovy script named archetype-post-generate.groovy in the src/main/resources/META-INF/ folder of your archetype in order to perform actions after the new project has been generated. The script should look like this one:

def file = new File( request.getOutputDirectory(), request.getArtifactId()+"RELATIVE_PATH" );
file.setExecutable(true, false);

where request.getOutputDirectory() is the directory where the new project will be created and request.getArtifactId() is the project artifact id.

like image 93
Fernando Wasylyszyn Avatar answered Sep 18 '22 20:09

Fernando Wasylyszyn