You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gajo Csaba <cs...@cosylab.com> on 2010/08/31 09:28:24 UTC

How do redefine the path to an element, in a custom mojo?

I took Stephen's advice and looked at the maven-ant-plugin to see how I 
can override the parsing of a plugin's configuration. Now I have a 
parser which works just fine, and can parse the following:

<configuration>
<packages>
<package name="xxx">
<dependency name="aaa" version="1.0" type="abc" />
         ...
</package>
</packages>
</configuration>

This all works fine for the objects Package and Dependency. The problem 
is these two objects must be located in the same Java package as where 
the main mojo is. What I mean is, if mojo is in 
com.company.plugin.HelloWorldMojo, then I must also have 
com.company.plugin.Package.

I would like to have com.company.plugin.model.Package. I'm guessing that 
I should override something in components.xml to redefine the location 
of the model object?

Anyway, I couldn't find it myself, so does anyone know what should I do 
to make this work?

I've looked at the source code of 
org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter 
and the way the object is loaded is basically this:

retValue = classLoader.loadClass( classname );

So I guess I could make some changes here myself, so that it would 
loadClass( packageName + classname );
but I was wondering if there's some "prettier" way to do it, possibly by 
declaring something in components.xml

Thanks for any help,
Csaba



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