This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Possible to change where Maven builds war from? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Possible to change where Maven builds war from?" Watch "Possible to change where Maven builds war from?" New topic
Author

Possible to change where Maven builds war from?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi,

I'm using Maven 3.0.3. I have an SCM plugin (v 1.5) that checks out a version of my code to the target/checkout directory. I would like to build my WAR from there, but I can't figure out how to do it. Any ideas? For what it's worth, I'm using Git 1.7.4.1.

Thanks, - Dave
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

From the maven faq:
Is it possible to create my own directory structure?

Absolutely yes!

By configuring <sourceDirectory>, <resources> and other elements of the <build> section.

In addition, you may need to change the plugin configuration if you are not using plugin defaults for their files/directories.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Dave, if I understand you correctly, you have a pom.xml that have the scm plugin configured and you run mvn with that pom.xml to extract the projects contents from the repository. And now you would like to know how to get mvn to finish the job by doing the rest of the build. Is that correct? (I hope so, otherwise the rest of my response will make no sense.)

You have a chicken-and-egg problem here. The pom.xml should really be in the source control system along with the rest of the project's files. So you actually have to pull one of the files (pom.xml) out of source control before you can even get started.

One of the possibilities is to configure the scm plugin to run as part of one of the early build lifecycle phases, such as generate-sources. Note that you would do this within the same pom.xml used to build the WAR. Your steps would then be to first extract the pom.xml file source control and then run Maven.

But I think that a better mechanism is to use a continuous integration system such as Jenkins (aka Hudson) to manage the build. When you configure Jenkins to build something, you tell it where to grab the source from version control and what tool to use to build it (e.g., Ant, Maven, etc). Jenkins then does all the rest.

JBoss In Action
 
 
subject: Possible to change where Maven builds war from?
 
Similar Threads
keeping properties file out of war
Maven-built WAR file not containing .hbm.xml files
add lib jars to war file using maven
What does maven "packaging = jar" mean ?
Maven 1.x question: How to build an additional jar when my WAR is built