aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Need help in Starting with 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 "Need help in Starting with Maven" Watch "Need help in Starting with Maven" New topic
Author

Need help in Starting with Maven

Kulpreet Singh
Greenhorn

Joined: Apr 12, 2012
Posts: 3
Hi All,

I have to use Maven as a build tool for my existing project. I need help in understanding that, i have limitation that i cannot modify the structure of project to what maven provides.

What all i have read till now it says that i have to move my source files to Maven structure and then can write my POM file. Is this a limitation of Maven or i can write my POM file with existing structure?

Will appreciate any help!!

Thanks,
Kulpreet
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 859

So you cannot modify the structure?

Although maven (some goals at least) requires a set structure?

Sounds like a conundrum to me.

It would help if we knew a little more about your project.

WP
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5843
    
    7

Resist the urge to bend Maven to your will. Even though you can redefine where things are located, not all plugins will recognize the new locations. Besides, one of the perks of Maven is that every project looks the same and is built the same way. Well, at least until you get into very complex projects that invoke a lot of specialty plugins, but even then you can define project types and every project of that type can look the same. My recommendation is to reformat the project, possibly breaking it up into multiple projects, to fit the Maven best practices. I spent the last half of last year doing this for a dozen projects, which turned into about 20 projects by the time I got done. But everyone is happier with the results than what we they before (it was pretty much managed chaos).

If you are still set on breaking Maven, you will have to pay close attention to the properties available for every plugin goal. You will also have to know the pom.xml structure inside and out. Between the pom.xml settings and the plugin properties, you should be able to relocate almost anything. I highly recommend that you do not attempt this until you are very familiar with how Maven works and have spent some time building things the maven way. If you are new to Maven, don't even think about trying it.


JBoss In Action
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16246
    
  21

Welcome to the JavaRanch, Kulpreet!

Probably Maven's 2 biggest strengths are that it automatically downloads dependencies and that it standardizes project structure, and you have apparently been commanded to discard one of those primary strengths.

As Peter has pointed out, attempting to force a non-Maven structure on Maven is tedious, difficult and error-prone. In business terms, it's expensive. Expensive to set up, expensive to maintain, and the project itself is more expensive to use, since unlike "real" Maven projects, you won't be able to just hand it to anyone anywhere and expect them to be able to instantly know where all the pieces are.

Although I'm not the biggest fan in the world of how Maven lays things out, it does work and it works well. And even if someday Maven goes away, the project organization still works.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
wood burning stoves
 
subject: Need help in Starting with Maven