maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Sand <>
Subject RE: creating a project property from dependency details
Date Mon, 16 Sep 2013 21:05:44 GMT
Hi Stephen - somehow I had a feeling you'd say that :-) I certainly
wouldn't want to abuse classifiers...

Ok so here's the summary of what our project is. The application here is a
Jersey JAX-RS application. There's the web application portion called
simply "gateway" and a client api which calls the gateway's REST services.

The maven structure here is:

* Base project (pom with some core plugins and properties defined) -->
    * common library project (output is common.jar) -->
        * web app project (output is called "gateway.war") -->
            * web app assembly project (outputs several zip files
containing bundled application server+deployed gateway)
        * client api project (output is called "client.jar")

I start abusing classifiers in the pom.xml for the gateway web app
project. Part of our project needs to be obfuscated, which is why I wrote
the lovely obfuscation plugin. So in addition to generating "gateway.war",
it also generates the war with the necessary classes obfuscated, for which
I use the classifier "small". So I end up with gateway-1.0.0.war and
gateway-1.0.0-small.war. By the way, this is where we're using a modified
maven war plugin, which we patched to add a useAttachedArtifacts option
(this may deviate from maven philosophy, but the assembly plugin for
example can do this).

In the client api project, I end up with api-1.0.0.jar and

Then there is the assembly project. Here we use the assembly plugin and
make zip files with a simple folder structure: /app, /conf, /log,
/license, /<server>. <server> can be tomcat or jboss thus far. So here is
where I'm doing the bulk of the classifier abuse. I create artifacts
called and
The actual war file e.g. gateway-1.0.0-small.war is put into /app. The pom
has properties for holding the version number of the gateway project
(1.0.0) and classifier (blank or "small") to use. It defaults to blank and
we can specify the classifier on the command line to tell it to use the
"small" classifier. On our Jenkins server we have separate jobs to build

Up to now, everything seems to work as we expect.

What I am trying to do now in these zip bundles is to generate the
appropriate configuration file so that the server is configured to deploy
the application context for the app (no auto-deploy webapps). For tomcat,
the file is called gateway.conf and goes in
/tomcat/conf/Catalina/localhost, and it contains a <contextpath> element
with the path to the war, which is something like

Is a little knowledge a dangerous thing?

I definitely acknowledge that I'm missing some maven philosophy and I
appreciate your input.

Best regards,


-----Original Message-----
From: Stephen Connolly []
Sent: Monday, September 16, 2013 2:15 PM
To: Maven Users List
Subject: Re: creating a project property from dependency details

I get the feeling there is something about the maven approach to doing
things that we are failing you by not explaining correctly.

The really annoying, for me, thing is that you keep coming close to the
established best ways... And then just at the last second you swerve
violently left/right to hijack and abuse properties and classifiers.

We need the big picture, then we can try and provide our considered view
and hopefully then you can either shine a light on where we were failing
you or you can show us how we are wrong and how your approach is more
obvious, less hacky and leads to a simpler overall build once encapsulated
in an appropriate plugin(s) / build extension(s) / packaging lifecycle(s)

The stuff you describe is *screaming* hack layered on hack layered on
hack... Which is an anti pattern to my mind

On Monday, 16 September 2013, Richard Sand wrote:

> Hi all,
> I've a project where I'm creating an assembly from a zipped up app
> server and a war file pre-deployed. The war file may be one of several
> different versions and (optionally) classifiers, which I provide via
> build
> properties:
>                                              <dependency>
> <groupId>com.idfconnect</groupId>
> <artifactId>myapp</artifactId>
> <version>${myapp.version}</version>
> <classifier>${myapp.classifier}</classifier>
> <type>war</type>
>                                              </dependency>
> I want to take the actual filename of the above dependency and inject
> it into a configuration file (e.g. a Tomcat context.xml file) using
> the codehaus template plugin. So the xml file would have something like:
> <Context path="/myapp" docBase="../app/${myapp.filename}">
> So I'd like to have this property "myapp.filename" determined
> dynamically based upon the dependency, mainly because the classifier
> may be blank, which makes it annoying to generate the proper filename.
> Is there a way I can instruct maven to derive the proper filename from
> the dependency, or do I need to write a plug-in to do this?
> I figure the template plugin could also be useful for things like
> inserting this information into a README file.
> Thanks for any advice!
> -Richard

Sent from my phone

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message