This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Possible to change where Maven builds war from?

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic