Mark the "target" folders as "derived" resource from the properties screen of those folders (this option is next to read only and archive property). In the quick search ( Ctrl + Shift + R ) screen press the arrow in the top right corner and untick "Show derived resources".
To delete the target directory, run mvn clean on your project directly from the command line. That will delete the target directory as expected. In contrast, running Run As > Maven clean from Eclipse for some reason leaves the target directory and subdirectories classes and test-classes.
The target folder is the maven default output folder. When a project is build or packaged, all the content of the sources, resources and web files will be put inside of it, it will be used for construct the artifacts and for run tests. You can delete all the target folder content with mvn clean command.
The maven targets are located in your project config/ folder.
Right click on the folder you want to ignore, open the "Properties" dialog, chose the "Resource" tab and check the box that says "Derived"
Reconfigure "clean" in Maven not to delete target directory:
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<!-- delete directories that will be generated when you
start the develpment server/client in eclipse
-->
<fileset>
<directory>target</directory>
<includes>
<include>**/*</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
(found at: http://maven.40175.n5.nabble.com/how-to-NOT-delete-target-dir-td3389739.html#a3413930)
Solution for Indigo [SR2]
Project Explorer
> Customize View
> Filters
> [*] Maven Build Folder
I have been so pissed by this problem that I wrote a plugin to solve it. You get get the source and jar from:
https://github.com/YA2O/Eclipse_Plugin_Target_Derivator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With