Kamilski81
Kamilski81

Reputation: 15117

Eclipse - marking 10 projects 'target' folder as derived

I would like to mark all of my 'target' directories as 'derived' in Eclipse. However I have about 10 projects and have to repeat the same process 10 times, is there any quick way of marking all 10 'target' folders as derived?

Upvotes: 9

Views: 4236

Answers (4)

johan d
johan d

Reputation: 2863

I wrote the AutoDeriv plugin to handle this specific task easily and efficiently. The short story:

  1. list the resources you want to set as derived on a simple .derived text file
  2. There is no 2.

Enjoy your clean workspace as resources are now correctly marked as 'derived'. The syntax is trivial, just like a .gitignore file.

For your specific case, create a .derived file at workspace root, write target in it, and your done.

I hope you will like it =)

Upvotes: 13

Janning Vygen
Janning Vygen

Reputation: 9212

It is not easy to set the Derived flag automatically, see Where does Eclipse store information about which files are "Derived"?

This is sad as I have to mark 20 subfolders as "Derived" each time I clone my project on a new machine. If you do it manually too, use the keyboard:

  • Alt-Enter
  • Alt-v
  • Enter
  • Cursor down
  • repeat

Upvotes: 1

lrkwz
lrkwz

Reputation: 6523

You got to remove third line from each .classpath

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
    <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

I.e. remove <classpathentry kind="src" output="target/classes" path="src/main/java"/>

Upvotes: 0

hoipolloi
hoipolloi

Reputation: 8044

Not sure what you mean by 'derived'. However, Eclipse writes most settings to an XML file. Figure out which config file (e.g. .classpath) gets altered and then run sed over all your config files at once.

Upvotes: 1

Related Questions