Skip to main content

Advice sought on how to best structure a maven project in

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2003-06-27


My project Swing Style ( consists of two 'projects'. The first is the actual library for Swing Style, the second is a demo app (webstart enabled) that uses the main Swing Style library to build a GUI and show case what the framework can do.

I'm curious if anyone has any thoughts on how best to structure this from a Maven perspective. Currently I have followed the 'one pom per artifact' approach and created these as two separate modules, each with their own pom. To make it easy for me to build everything in one go, I have made a parent pom that these both share. This parent pom lives under 'trunk' and the other two projects under that. So my directory structure is:

~svn/trunk/pom.xml <-- parent pom, artifactId=swing-style-parent
~svn/trunk/swing-style/pom.xml <-- main project pom, artifactId=swing-style (inherits from swing-style-parent)
~svn/trunk/swing-style-demo/pom.xml <-- demo project pom, artifactId=swing-style-demo (inherits from swing-style-parent)

This works but when I now deploy to the public maven repo, I have to also deploy swing-style-parent because it is referenced by swing-style, and as a result, swing-style-demo also gets deployed.

Obviously there is no need for swing-style-demo to be in the main repo as it will never be used as a library that way. On the other hand, it doesn't really cause any problems being there.

My alternatives would be to drop the parent pom and just have the two projects be built independently of each other, or try and find some way to include them in the same project and only have one pom in total (producing two artifacts, which seems to go against the maven principles).

Does anyone have thoughts on this, has anyone done anything similar and come up with an approach they are happy with?



Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2009-04-22

Your current directory structure is totally fine, all you need to do is configure maven-deploy-plugin for swing-style-demo module, and set the skip parameter to be true so when 'mvn deploy' run into this module, it will be skipped.

BTW, if you have any more question regarding maven repository, please create tickets at or go to the mailing list