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

custom project structure in Maven

praneeth ram
Ranch Hand

Joined: Sep 21, 2009
Posts: 60
Hi all,

How can i create my own project structure through maven.

myproj
-----src
-------java
-----target
-----client
-----server
-----clientxmlfiles
--------------abc.xml
--------------123.xml


my own folder structure. how can achieve this.

Thank your,
Praneeth.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16236
    
  21

Like you, I don't really like Maven's project structure all that much. But there a several reasons why we recommend not trying to setup one's own project structure instead.

One of the main ones is simply that - ugly as it is - it's a standard. So if you take the money and run, whoever comes after you can come up to speed fairly fast on the project, knowing where things are without having to know your own personal preferences in file locations.

But you may not care about that one. A more selfish one is that it's a royal pain to implement. You have to forcibly override all the various plugins and mojos, since by default they are all assuming that you've adhered to the standard project structure. It's a lot more expensive to set up and maintain, and anyone else who might come in on the project is probably going to hate you.


Customer surveys are for companies who didn't pay proper attention to begin with.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5842
    
    7

I'll echo what Tim said, though I do like the basic directory structure (though there are a few things that could be improved). But trying to change it is a sure way to cause all kinds of aggravation and grief. If you have an existing project with that directory structure, I recommend that you create a new Maven project and copy your sources files to their corresponding locations in the new directory structure.

I notice that you have "client" and "server" as directories. Are you actually building two different JARs? If so, you should have two projects, one for each. Maven likes to enforce one artifact per POM.

By the way, I have sent the past 6 months moving over a set of projects from quasi-Ant/Eclipse builds to Maven (where the build was done manually), and that involved redoing the directory structure for most projects and splitting many of the projects into multiple projects. Everyone on the project team quickly picked up the new directory structure, and builds are now automated with Jenkins.


JBoss In Action
 
 
subject: custom project structure in Maven