4

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?

Marcel
  • 4,054
  • 5
  • 36
  • 50
  • depending on your system setup, you could just mark those files as read-only, or remove write access for the developer in that directory – Epicblood Dec 21 '14 at 01:39
  • That is one possibility, but it's not clear how the SCM works with RO and how it is when the files are generated (which happens usually during every build). I was hoping that there is an Eclipse-build-in feature. – Marcel Dec 22 '14 at 13:10

2 Answers2

1

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.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
0

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.

Davis
  • 31
  • 1
  • Thats not exactly what I want because I would like to see the files. In Netbeans for example it is even possible to lock some code-blocks with GEN-BEGIN:initComponents. It's not that I don't want to see them, I just don't want to be able to edit them. – Marcel Dec 22 '14 at 13:05