You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jason van Zyl <ja...@zenplex.com> on 2003/05/20 11:59:44 UTC

Re: taskdefs and plugins?

On Tue, 2003-05-20 at 09:56, Neil Blue wrote:
> I have been reading around the maven site and looking at the plugins.
> Although maven supports the ant tasks, is is the intention that we write
> maven plugins now, where we would have written ant tasks and used taskdef
> elements before?

Write beans that can be used from anywhere. There is a very popular
misconception that plugins need to be written entirely in Jelly. This is
wrong. Write a simple bean to do what you want and if written correctly
you can use this bean from Jelly or anywhere else like an IDE.

Jelly makes it dead simple to use normal beans inside Jelly script and
having the code in Java makes testing easier and more reliable IMO.

For example I have rewritten the Plexus plugin to be a Java bean so I
can hook this into Jelly easily if I choose, but I can also use it from
an IDE. If you go the route of a bean (or some scripting alternative
that truly allows inheritance like beanshell or jython) then you can use
your code in more places than simply Jelly. Avoid writing JellyTags or
Ant Tasks because each is bound to the particular environment. Ant can
be a particular problem wrt ClassLoaders. Make a bean, and then adapt
it, wrap it, decorate it or whatever else you have to do to make it work
in a particular environment.

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

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


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


Re: taskdefs and plugins?

Posted by Rafal Krzewski <Ra...@caltha.pl>.
Jason van Zyl wrote:

> I think people tend to make things more complicated than necessary
> and as soon as you starting binding the core of whatever you are
> doing to an execution environment you're hosed. I've speak from
> experience as I've been hosed more often than I would like to admit.

Two notes here.

Sometimes you may find yourself putting so much effort in isolating
your code from the execution evirionment, that it actually makes it
more complex and fragile. Constant strife for balance is a fundamental
feature of human life...

As long as your logic can be encapsulated into a single "bean" everyting
looks simple. But at the very moment the logic needs to cooperate with
other "beans" many problems arise. At this point you need to start
making some assumptions about the execution evironment. Because of that
I'm really happy to see that maven-new is built upon Avalon - a
concise yet powerful framework that provides thin integration layer
both between "beans" themselves, and between "beans" and the execution
environment.

> Being from Canada that makes me a hoser eh? (Bad Canadian references
> are bound to occur this close to Victoria Day).

Suppose you know, that this souds like line noise out here in the East?
;-)

R.


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


Re: taskdefs and plugins?

Posted by Jason van Zyl <ja...@zenplex.com>.
On Tue, 2003-05-20 at 10:31, Mark R. Diggory wrote:
> Jason,
> 
> Wow, a good and often overlooked detail about extending Jelly 
> capabilities. I wrote my own entire set of Jelly Tags to extend another 
> package into Jelly, mostly because it was not very JavaBean in nature 
> (no default constructors, lots of non-get/set methods). So the 
> taglibrary does actually just act as a wrapper around a set of basic 
> java objects.

When I say bean I really mean just a plain java object. Doesn't have to
be a bean per se, the things I write just tend to expose things with
accessors and I just call them beans.

> I didn't need to do this to use the objects, I could have done it in 
> more "verbose" fashion with the core taglibrary, but I wanted to control 
> the markup used with my objects too, eventually attempting to validate 
> it with schemas.
> 
> Jelly could use a really good example of your outline for using normal 
> beans(classes) and tags as wrappers (when even required) within its site 
> Tutorial. It is a design that I think should be promoted.

The changelog plugin is a good example:

  <define:taglib uri="changelog">
    <define:jellybean
      name="changelog"
      className="org.apache.maven.changelog.ChangeLog"
      method="doExecute"
      />
  </define:taglib>

Really, it's as simple as creating a dynamic tag library that uses the
define:jellybean notion. In essence you grab onto a normal bean by
providing a class name and the method to execute to fire the bean into
motion. Using accessors to set values is also generally better too as
you knows where you might use the bean and using tools like beanutils or
OGNL is easier with beans then trying to fart around with constructors
and reflection.

Really you need to focus on what you want to accomplish without getting
distracted by where you want to run the bean. There are so many good
tools/techniques now for wrapping plain java objects to make them work
in various environments. I know you're familiar with BCEL and I'm sure
someone could come up with a way to wrap a bean and turn it into an ant
task dynamically. I tend to use AspectJ, some people use dynamic proxies
and other forms of method interception. 

So again using my little Plexus generator as an example, the core
generates the runtimes but I'm working on a layer that sits above the
core with array of listeners so that the Plexus generator can work in an
IDE. This I can definitely use as an example when it's working decently.
Dan is actually going to try to get it to work in eclipse. I think
people tend to make things more complicated than necessary and as soon
as you starting binding the core of whatever you are doing to an
execution environment you're hosed. I've speak from experience as I've
been hosed more often than I would like to admit. Being from Canada that
makes me a hoser eh? (Bad Canadian references are bound to occur this
close to Victoria Day).

> -Mark
> 
> Jason van Zyl wrote:
> > On Tue, 2003-05-20 at 09:56, Neil Blue wrote:
> > 
> >>I have been reading around the maven site and looking at the plugins.
> >>Although maven supports the ant tasks, is is the intention that we write
> >>maven plugins now, where we would have written ant tasks and used taskdef
> >>elements before?
> > 
> > 
> > Write beans that can be used from anywhere. There is a very popular
> > misconception that plugins need to be written entirely in Jelly. This is
> > wrong. Write a simple bean to do what you want and if written correctly
> > you can use this bean from Jelly or anywhere else like an IDE.
> > 
> > Jelly makes it dead simple to use normal beans inside Jelly script and
> > having the code in Java makes testing easier and more reliable IMO.
> > 
> > For example I have rewritten the Plexus plugin to be a Java bean so I
> > can hook this into Jelly easily if I choose, but I can also use it from
> > an IDE. If you go the route of a bean (or some scripting alternative
> > that truly allows inheritance like beanshell or jython) then you can use
> > your code in more places than simply Jelly. Avoid writing JellyTags or
> > Ant Tasks because each is bound to the particular environment. Ant can
> > be a particular problem wrt ClassLoaders. Make a bean, and then adapt
> > it, wrap it, decorate it or whatever else you have to do to make it work
> > in a particular environment.
> > 
> > 
> >>Neil
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


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


Re: taskdefs and plugins?

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
Jason,

Wow, a good and often overlooked detail about extending Jelly 
capabilities. I wrote my own entire set of Jelly Tags to extend another 
package into Jelly, mostly because it was not very JavaBean in nature 
(no default constructors, lots of non-get/set methods). So the 
taglibrary does actually just act as a wrapper around a set of basic 
java objects.

I didn't need to do this to use the objects, I could have done it in 
more "verbose" fashion with the core taglibrary, but I wanted to control 
the markup used with my objects too, eventually attempting to validate 
it with schemas.

Jelly could use a really good example of your outline for using normal 
beans(classes) and tags as wrappers (when even required) within its site 
Tutorial. It is a design that I think should be promoted.

-Mark

Jason van Zyl wrote:
> On Tue, 2003-05-20 at 09:56, Neil Blue wrote:
> 
>>I have been reading around the maven site and looking at the plugins.
>>Although maven supports the ant tasks, is is the intention that we write
>>maven plugins now, where we would have written ant tasks and used taskdef
>>elements before?
> 
> 
> Write beans that can be used from anywhere. There is a very popular
> misconception that plugins need to be written entirely in Jelly. This is
> wrong. Write a simple bean to do what you want and if written correctly
> you can use this bean from Jelly or anywhere else like an IDE.
> 
> Jelly makes it dead simple to use normal beans inside Jelly script and
> having the code in Java makes testing easier and more reliable IMO.
> 
> For example I have rewritten the Plexus plugin to be a Java bean so I
> can hook this into Jelly easily if I choose, but I can also use it from
> an IDE. If you go the route of a bean (or some scripting alternative
> that truly allows inheritance like beanshell or jython) then you can use
> your code in more places than simply Jelly. Avoid writing JellyTags or
> Ant Tasks because each is bound to the particular environment. Ant can
> be a particular problem wrt ClassLoaders. Make a bean, and then adapt
> it, wrap it, decorate it or whatever else you have to do to make it work
> in a particular environment.
> 
> 
>>Neil
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org


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