You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Luke Blanshard <lu...@blanshard.us> on 2006/12/29 23:36:41 UTC

Help for project layout

Hello all, thanks in advance for any advice you can give me.

I have a small Java project I've put under Maven, but I'm not really 
happy with the layout I ended up with.  (I've released the initial 
version, if you're interested, see [1].)

This library has two quirks that take it out of the simple little 
universe that Maven seems to want us all to inhabit.  First, it has a 
core that requires jdk1.4 and an optional extension that requires 
jdk1.5.  Second, I have to bundle parts of ASM [2] with it, relocating 
those parts into my package space using Jar Jar Links [3].

This is a tiny little library, adding up to fewer than a dozen classes.  
The total size of the jar, including ASM, is under 100K.  So it makes 
zero sense to release this as multiple different projects.  What I'd 
like to release is a jar file, a source jar, and a javadoc jar, all 
covering the entire codebase.  And possibly a zip with all 3 of those 
jars in it.

I understand that the two different compilation requirements force me 
into a multi-project layout.  So I have a parent pom and then children 
for those two different code bases:

  stubout
    |
    +-- stubout-java14
    |
    +-- stubout-java5

But this is where it starts getting ugly.  I'd like to just aggregate 
the jars and the source and the javadoc in the parent, apply the jarjar 
transformation right there, and produce artifacts right from the stubout 
parent project.  But I haven't been able to figure out how to do that.  
HELP!

Instead, I've come up with this:

  stubout
    |
    +-- stubout-java14
    |
    +-- stubout-java5
    |
    +-- stubout-release
    |
    +-- stubout-itest

The stubout-release project uses the dependency plugin to aggregate the 
sources and classes from the java projects, and then uses the jarjar ant 
task to rebase the ASM components I need into a stubout-release jar 
file.  But I can't just aggregate javadoc that way -- I really need to 
run javadoc over both java projects simultaneously, and I don't know how 
to do that.

Next, I want to run an integration test _against the generated release 
jar file_.  But the integration-test phase does not include the jar file 
in the classpath, so I can't do that in the same project.  Hence the 
itest project, which depends on the release project.

Incidentally, I can generate the aggregate javadoc just fine if it's 
done as part of the site building -- the whole reason I'm using Maven -- 
and so I've worked around the problem by just leaving the javadoc 
artifact out of my set and referring users to the web site.  But I'm 
unable to run javadoc in aggregate mode except as part of the report 
process.

So, here are my questions boiled down:

1. Can I dispense with the -release and -itest projects and build the 
products I want right from the parent pom?

2. If not, can I at least get rid of the -itest project?

3. Is it possible to build an aggregate jar of javadoc as part of the 
normal build process, rather than as part of the site generation process?

And here's another tangential question:

4. Isn't there a way to hide the messy build details (ie the two 
separate code bases for jdk1.4 and jdk1.5) from the public pom 
structure?  (I guess this is more of a rhetorical question, but if 
anyone has any thoughts on this I'd like to hear them.)

Again, many thanks for reading this far,
Luke Blanshard


References:

[1]: http://stubout.sf.net/
[2]: http://asm.objectweb.org/
[3]: http://tonicsystems.com/products/jarjar/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Help for project layout

Posted by Luke Blanshard <lu...@blanshard.us>.
Jörg Schaible wrote:
> Not necessarily. See the jdk15 profile in
> http://svn.xstream.codehaus.org/browse/xstream/trunk/xstream/pom.xml
>   

Thanks, this would simplify things a great deal!  I'll give it a shot.

Luke

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Help for project layout

Posted by Jörg Schaible <jo...@gmx.de>.
Luke Blanshard wrote:

> Hello all, thanks in advance for any advice you can give me.
> 
> I have a small Java project I've put under Maven, but I'm not really
> happy with the layout I ended up with.  (I've released the initial
> version, if you're interested, see [1].)
> 
> This library has two quirks that take it out of the simple little
> universe that Maven seems to want us all to inhabit.  First, it has a
> core that requires jdk1.4 and an optional extension that requires
> jdk1.5.  Second, I have to bundle parts of ASM [2] with it, relocating
> those parts into my package space using Jar Jar Links [3].
> 
> This is a tiny little library, adding up to fewer than a dozen classes.
> The total size of the jar, including ASM, is under 100K.  So it makes
> zero sense to release this as multiple different projects.  What I'd
> like to release is a jar file, a source jar, and a javadoc jar, all
> covering the entire codebase.  And possibly a zip with all 3 of those
> jars in it.
> 
> I understand that the two different compilation requirements force me
> into a multi-project layout.  So I have a parent pom and then children
> for those two different code bases:
> 
>   stubout
>     |
>     +-- stubout-java14
>     |
>     +-- stubout-java5

[snip]

Not necessarily. See the jdk15 profile in
http://svn.xstream.codehaus.org/browse/xstream/trunk/xstream/pom.xml

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org