[EMAIL PROTECTED] wrote:
> Hi all,
>
> Thanks for those who anwered to my previous mails, everything works fine
> now !
> Here is a deeper question...
> We are migrating a J2EE project from an ANT build to a Maven build.
>
> Our problem is that, in one subproject, we need to generate
> different jars and wars from the same sources (client, server, webservice).
> One would answer that we can divide this project into several subprojects,
> but we don't want the same source code to be present in different projects.
>
> So, the question is :
> Is it possible to have one Maven project (with only one project.xml)
> that generates multiple jars and wars ?
> And if not, has anybody tried to customize Maven to do that ?
It is definetely possible without copying your sources around (which
would be the shortest path to chaos and misery).
One of your options would be creating a master project that contained
all the sources and a POM defining shared stuff (current version,
dependencies...) a few subprojects. Each of the subrojects would declare
that it's sources are in ${basedir}/../src/java
Another option would be defining overriding maven goals like java:jar
or jar:install in your project's maven.xml to do all the packaging work.
The one-to-one relationship between POM and generated artifact is one of
key concepts of maven. On the other hand it proves limiting in many
situations, and forces the users to do maven.xml hackery to subvert it.
I would dare saying that the POM<->artifact paradigm is not really
followed in almost any Maven project. Namely in virtuay any project
you generate your artifact (be it jar, war, or ear) AND the
documentation. The documentation could be packaged into a zip or tar.gz
and become a fully featured artifact built from your project (and it's POM).
I think that in the future Maven may be extended to support the single
POM -> multiple artifacts scenario. I think that it would not introduce
any conceptual problems into maven, as long as the artifacts are
explicitly declared in the pom. This way you could declare that your
project is able to generate server side ejb jar + client side ejb jar +
API documentation, or an ear + source tarball + developer documentation
tarball + user documentation tarball + a website.
R.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]