• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maven clean output directory

 
Matthew Snow
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've built a maven-archetype-webapp which builds to the target/ directory when I package the project. I want to maven to clean the target/ directory each time I package the project though. I imagine I would specify this in the build element of my pom.xml. Does anyone know how to do this?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe it's automatic. But "mvn clean" should do a clean-only operation.
 
Matthew Snow
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, thanks, mvn clean does clean the target directory. I don't suppose I can configure my pom.xml build element to clean before it builds the project?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, what I meant was I think that the first think maven will do is run a clean operation in the course of a normal build. But I won't swear to it.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From recent experience, Maven does not force a "clean" before it does a build by default. However, the usage page for the "clean" plugin describes how to enable this.
 
Matthew Snow
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link. That's what I was after.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic