Is it possible to mark files/folders in Eclipse as generated?

918 Views Asked by At

my project structure looks like this:

src/main/java
src/main/resources
src/main/generated
....

in the generated folder I place a files which are generated by external software (for example classes generated by JAXB).

In Eclipse all mentioned folders are marked as Source folders.

Is is somehow possible to mark the file in src/main/generated as 'generated' or lock them in another way so that the developer in eclipse is unable to change them?

2

There are 2 best solutions below

0
On

I don't know if it is possible to do this via the Eclipse UI, but there are APIs that allow a plug-in to mark something as a "derived resource".

Reference:

You can't prevent the user from editing a derived resource, but he / she does get a warning.

1
On

The right way of doing is to hide the folder in Eclipse, so that other developers cannot modify it.

Right-click on the project and select properties, then look for "Resource filter".

Click "Add" to add a new filter and fill in the form with all the information. Don't forget to write the name of the folder in "File and folders attributes". Also, select "Files and folders" and "Recursive".

Click ok.

Your folder should disappear from Eclipse, but not from the disk.