This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes recompile maven project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "recompile maven project" Watch "recompile maven project" New topic

recompile maven project

Rakesh Basani
Ranch Hand

Joined: Jun 04, 2012
Posts: 38
Hi guys..

I am working on a spring maven project. Is it necessary to compile my project again if I change pom.xml. And exaplain the reason.

Thanks in advance
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

Your POM defines how a project is built. If you change it, typically you are changing something about how the projects gets built. Therefore it's only logical that you would rebuild the project (recompile) to reflect those changes.

An IDE is no substitute for an Intelligent Developer.
Peter Johnson

Joined: May 14, 2008
Posts: 5852

I guess it depends on the change that you made and what your end goal is.

Did you add a dependency? Then maybe. I assume that the project built and the tests ran without it, so adding it might not have that much of an impact. But if you are packing your project using the asembly plugin and you noted that that dependency was missing, then yes re-run the build so that it gets included in the package.

Did you change the artifact's description? Then only if you plan to regenerate the site would you need to build again.

Did you add or change a plugin? Then yes because you have changed how the project gets built.

Did you change the version number. Then maybe. If other projects are already referencing yoru artifact by the new number then yes you must rebuild. If not, then you don't have to.

I could go on, but you probably get the idea.

JBoss In Action
I agree. Here's the link:
subject: recompile maven project
It's not a secret anymore!