You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by micah craig <mi...@micahcraig.net> on 2006/07/11 13:10:54 UTC

binding ant plugin to specific packaging

Hello,
    I've been working on what I'd hoped would be a fairly simple plugin
in Ant, but I'm coming up against great difficulty trying to get it
bound only to those project which I want it to execute for.  I've tried
every hack I can think of, from trying to override inherited plugin
configuration with non-inherited, to adding extra goals to the Ant
script to set a property based on the value of ${project.packaging} to
creating a profile and attempting to bind it to war packaging only, but
nothing seems to work.  I'm at my wit's end, and short of rewriting the
plugin in Java or inventing a new packaging with components.xml, both of
which seem like huge amounts of overkill for the problem in front of me,
I don't know what to do.
    A quick overview of our situation: we have a hierarchical project
layout, with all our webapps underneath a parent apps project.  The apps
project is packaged as a POM, and the webapps, obviously, are packaged
as wars.  The plugin I'm working on is just a shortcut for rapid
deployment to our Resin servers in development.  It simply creates a
symbolic link from the exploded webapp directory to Resin's webapps
directory, allowing for rapid reving, particularly for simple JSP
changes.  (I realize this solution isn't portable.  It's an in-house
solution, tailored to our standard development environment.)  I want to
bind this plugin to the install phase in apps/pom.xml, so that the
behavior will be inherited by all our webapps, but when I do the plugin
is executed in the install phase of the build for the apps project its
self, and I end up with an extra link to 'apps/target/apps' in my Resin
webapps directory.  This isn't the end of the world, but it is messy,
and I'd like to avoid it.
    So, as I say, I've tried adding some logic to my Ant scripts to test
for the packaging, but I haven't been able to get that to work as it
seems that properties fall out of scope as soon as target completes.  I
tried providing two configurations of the plugin in the apps/pom.xml,
one inherited and the other not, with the non-inherited configuration
bound to the fictional 'never' phase, but this didn't fly either.  I've
tried creating a profile for war builds, but I can't get it to activate
based on the ${project.packaging} setting.
    Is there a correct solution to this problem, or am I going to have
to use a sledge hammer to swat a fly?  Any help would be hugely
appreciated.  Thanks,

    -micah


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