You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Anil-C <ac...@gmail.com> on 2009/08/25 21:46:39 UTC

Can we write a custom webapp plugin that uses the war plugin and its configruation?

I am trying to create a new plugin webapp with two goals clean and refresh to
extend the functionality of the maven-war-plugin. webapp:clean would clean
the webappDirectory and webapp:refresh would refresh the warSourceDirectory
and apply modifications to the webappDirectory (similar to war:exploded but
doesn't proces the source directory) skipping the web.xml (guessed it right,
hotdeploy for jsp's, tags, images alone) and ofcourse use the configuration
defined in maven-war-plugin as it is like any filtering, blah blah, without
. 

The way i am hoping to achieve this is,get hold of the maven-war-plugin
instance based on the project pom somehow and invoke custom methods with in
that Mojo. I don't know if there is a way to do the first part?

I have digged through the users forum and the tutorials/blogs available on
maven plugin development. However, i couldn't find a good example that i can
refer to in my situation. I am not experience plugin writer (infact this is
the first onmy own, apart from the standard hello world examples). Any
suggesstions that can help me getting through my first plugin is greatly
appreciated.

Thank you
Anil
-- 
View this message in context: http://www.nabble.com/Can-we-write-a-custom-webapp-plugin-that-uses-the-war-plugin-and-its-configruation--tp25140948p25140948.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Can we write a custom webapp plugin that uses the war plugin and its configruation?

Posted by Anil-C <ac...@gmail.com>.
Thanks for the quick reply. I have tried this plugin earlier thats not what i
wanted. This plugin reads the metadata information of the plugin at compile
time. I need something that can read the configuration of from the pom for
maven-war-plugin (if no configuration specified, take defaults), and provide
them to my custom plugin. To give an example, below is the current
configuration we have in our web application.

<pom.xml>
... 
...
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-war-plugin</artifactId>
      <configuration>
      <warSourceDirectory>src/webapp</warSourceDirectory>
      <webappDirectory>${jboss.expldoed}</webappDirectory>
      <filters>
        <filter>src/main/filters/${filter}.properties</filter>
      </filters>
      <webResources>
        <resource>
          <directory>src/webapp/WEB-INF</directory>
          <filtering>true</filtering>
          <includes>
            <include>tabconfig.xml</include>
          </includes>
        </resource>
      </webResources>
    </configuration>
  </plugin>
...
...
</pom>

When i use my custom goal webapp:refresh - i would like to refresh the
webapp directory alone using the above configuration. I would really not
like to redefined this configuration again for my custom plugin of the pom.




Sven Preßler wrote:
> 
> You might want to take a look at the maven-inherit-plugin:
> http://www.ops4j.org/projects/pax/construct/maven-inherit-plugin/
> 
> -Sven
> 
> 
-- 
View this message in context: http://www.nabble.com/Can-we-write-a-custom-webapp-plugin-that-uses-the-war-plugin-and-its-configruation--tp25140948p25142714.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Can we write a custom webapp plugin that uses the war plugin and its configruation?

Posted by Sven Preßler <sv...@gmail.com>.
Hi Jörg,

never thought of that, thanks.
Didn't have any problems so far, though.

-Sven


2009/8/26 Jörg Schaible <jo...@gmx.de>

> Hi Sven,
>
> Sven Preßler wrote:
>
> > You might want to take a look at the maven-inherit-plugin:
> > http://www.ops4j.org/projects/pax/construct/maven-inherit-plugin/
>
> Honestly, this plugin leads directly into Maven plugin dependency hell. If
> you like to have arbitrary side effects in multi-project builds, well, go
> ahead and use it - otherwise stay as far away as you can.
>
> Why? Maven will load each plugin only once. Now, if you write an extension
> to the maven-compiler-plugin and refer e.g. version 2.0 as dependency and
> in your POM you declare the maven-compiler-plugin with version 2.2, it
> depends on your build order which version of the compiler plugin is used.
> However, from your POM you'll never ever recognize that this extension will
> actually inject an old version of the maven-compiler-plugin and it might
> simply fail on unknown configuration elements or the other way round, your
> extension plugin can fail, because the newer version is no longer
> compatible (Maven plugins are never required to be binary compatible).
>
> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Can we write a custom webapp plugin that uses the war plugin and its configruation?

Posted by Jörg Schaible <jo...@gmx.de>.
Hi Sven,

Sven Preßler wrote:

> You might want to take a look at the maven-inherit-plugin:
> http://www.ops4j.org/projects/pax/construct/maven-inherit-plugin/

Honestly, this plugin leads directly into Maven plugin dependency hell. If
you like to have arbitrary side effects in multi-project builds, well, go
ahead and use it - otherwise stay as far away as you can.

Why? Maven will load each plugin only once. Now, if you write an extension
to the maven-compiler-plugin and refer e.g. version 2.0 as dependency and
in your POM you declare the maven-compiler-plugin with version 2.2, it
depends on your build order which version of the compiler plugin is used.
However, from your POM you'll never ever recognize that this extension will
actually inject an old version of the maven-compiler-plugin and it might
simply fail on unknown configuration elements or the other way round, your
extension plugin can fail, because the newer version is no longer
compatible (Maven plugins are never required to be binary compatible).

- Jörg


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


Re: Can we write a custom webapp plugin that uses the war plugin and its configruation?

Posted by Sven Preßler <sv...@gmail.com>.
You might want to take a look at the maven-inherit-plugin:
http://www.ops4j.org/projects/pax/construct/maven-inherit-plugin/

-Sven


2009/8/25 Anil-C <ac...@gmail.com>

>
> I am trying to create a new plugin webapp with two goals clean and refresh
> to
> extend the functionality of the maven-war-plugin. webapp:clean would clean
> the webappDirectory and webapp:refresh would refresh the warSourceDirectory
> and apply modifications to the webappDirectory (similar to war:exploded but
> doesn't proces the source directory) skipping the web.xml (guessed it
> right,
> hotdeploy for jsp's, tags, images alone) and ofcourse use the configuration
> defined in maven-war-plugin as it is like any filtering, blah blah, without
> .
>
> The way i am hoping to achieve this is,get hold of the maven-war-plugin
> instance based on the project pom somehow and invoke custom methods with in
> that Mojo. I don't know if there is a way to do the first part?
>
> I have digged through the users forum and the tutorials/blogs available on
> maven plugin development. However, i couldn't find a good example that i
> can
> refer to in my situation. I am not experience plugin writer (infact this is
> the first onmy own, apart from the standard hello world examples). Any
> suggesstions that can help me getting through my first plugin is greatly
> appreciated.
>
> Thank you
> Anil
> --
> View this message in context:
> http://www.nabble.com/Can-we-write-a-custom-webapp-plugin-that-uses-the-war-plugin-and-its-configruation--tp25140948p25140948.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>