jQuery in Action, 3rd edition
The moose likes Ant, Maven and Other Build Tools and the fly likes Migrating To Maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Migrating To Maven" Watch "Migrating To Maven" New topic

Migrating To Maven

Arun Kumar
Ranch Hand

Joined: Jan 21, 2005
Posts: 133

Hi All,

I was given an assignment to Migrate a project to Maven given the condition that there should be no source code modifications.First it seemed easy as I thought the only challenge was to use a custom folder structure rather than the predefined structure of maven

But soon I have hit a road block the project contains many XML files which are placed along with the java code within the java package and are loaded using getResourceAsStream("path to package")

When I run mvn:compile, maven ignores these xmls and as a result the deployment fails I cant move them to resources directory as there will be a lot of code changes

Is there a way to specify to take xml and java files from the same package in Maven
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 430

Have a look at the resources plugin. It should look something like that then:

Look also here.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

People who try to overrule Maven's built-in directory assumptions tend to have very unhappy lives.

I don't say I really love some of the things they do myself, but one of Maven's main selling point is the fact that you know where to look for stuff because Maven rams it down everyone's throat impartially.

On the other hand, there must be something really odd about your project if the mere act of relocating your source and resource directories requires Java code changes.

An IDE is no substitute for an Intelligent Developer.
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

I agree with Tim - When using Maven, you'll make your life a lot easier if you follow the Maven source code structure. Although, Maven does allow configuring a different structure for your project, it can really turn out to be messy in the long run, especially with all those plugin configurations. That would then defeat the purpose of switching to Maven.

[My Blog] [JavaRanch Journal]
I agree. Here's the link: http://aspose.com/file-tools
subject: Migrating To Maven
It's not a secret anymore!