There is a clean
goal which deletes target
folder. Is there a way to clean up just test sources without deleting already compiled project files?
Asked
Active
Viewed 1,161 times
1

Cherry
- 31,309
- 66
- 224
- 364
-
http://stackoverflow.com/questions/5702232/maven-how-to-delete-contents-of-a-folder-during-a-clean-phase might help – seenukarthi Feb 17 '16 at 04:52
-
Are you asking to delete the source code for the tests? Why? Maven structure only run the tests in the test phase and it will not package it with your project. So why delete the tests sources or resources if they don't get packaged? – Jorge Campos Feb 17 '16 at 05:02
-
I am writing integration tests, so I have to experiment with Spring xml config for that. So compiled once, maven do not recompiled test sources and resources. – Cherry Feb 17 '16 at 05:09
-
You mean you need to run the tests with different spring configurations is that it? You may need just configure profiles in your maven POM such as you can run different profiles and for each profile you replace some configuration on you spring xml file. – Jorge Campos Feb 17 '16 at 05:41
1 Answers
0
You can delete the target/test-classes
directory to remove all of the compiled classes and resources built during the test-compile phase.
I am not aware of a maven task that does that for you.
I am assuming your pom configuration does not change the ${project.build.testOutputDirectory}
variable which controls the location of test classes.

absurdhero
- 356
- 1
- 11