I have a maven multi-modules project which has a depth of around 5 levels.
I'm now moving to git and I see that a lot of the content of the target
folder is captured by git as "Unstaged Changes".
I've googled a lot and searched SO but couldn't find an answer as to how to get git to ignore the entire directory tree of the target
folder.
My .gitignore
, which resides at the root of the project, looks like this:
.project
.classpath
.settings/
target/
The strange thing is that the .class
files, which reside somewhere under the target
tree, do get ignored by the above definitions but files like MANIFEST.MF
, pom.properties
or my own application properties files which are located somewhere in the target
directory tree are not ignored.
I've read Git Ignores and Maven targets but that solution does not seem to work for me.
I can also say that when I try to add target/*
rule it doesn't change anything and when I replace target/
with the target/*
then the .class
files appear as unstaged as well.
I'd really appreciate some guidance as it seems very unlikely to me that the hordes of people using git and maven haven't already resolved similar issues. Thanks.