I am using the Eclipse plugin "m2e" to compile and generate the source for the my project. But when I do modification to the code and try use "Maven clean" before recompiling it says "Building successfully" but the generated source still exit. Also, after "Maven clean", if I do "Maven build" I get errors and have to restart Eclipse in order to build the project. Any idea why how to fix "Maven clean" such that will work ok?
-
1what is the error you are getting? – fmucar Jul 31 '12 at 08:35
-
1first try to do same from command line without eclipse. will it fix this issue? – Igor Konoplyanko Jul 31 '12 at 08:35
-
From the command line it works. I have tried to run the project using the maven commands and it works. From Eclipse it does not work :( – Calin Andrei Jul 31 '12 at 08:42
2 Answers
It looks like you have some generated source
. Maven clean
only deletes the target
folder. If you need it to clean
other folders/files, you need to define maven clean plugin
in your pom and configure it suitably.

- 51,854
- 11
- 110
- 122
-
? in maven, generated sources usually *are* inside the target folder – Sean Patrick Floyd Jul 31 '12 at 10:19
Are you on Linux or Mac OS X? Note that another process (e.g. a shell) may have the directory with the generated sources as its current directory. Then deleting the directory from another process will work, but the same process will still see this "stale" directory as its current directory. This will change as soon as you change the current directory to a parent directory.
EDIT: On Windows, a process having a directory as its current directory or accessing any of it's members will prevent any other process from removing that directory. So it seems that Eclipse is somehow accessing the target directory.

- 3,125
- 1
- 23
- 47