[ 
http://jira.codehaus.org/browse/MAXISTOOLS-8?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dennis Lundberg moved MOJO-501 to MAXISTOOLS-8:
-----------------------------------------------

    Component/s:     (was: axistools)
            Key: MAXISTOOLS-8  (was: MOJO-501)
        Project: Maven 2.x Axis Tools Plugin  (was: Mojo)

> Can't specify namespace mappings to the Emitter as <mappings> element.  Fix 
> supplied
> ------------------------------------------------------------------------------------
>
>                 Key: MAXISTOOLS-8
>                 URL: http://jira.codehaus.org/browse/MAXISTOOLS-8
>             Project: Maven 2.x Axis Tools Plugin
>          Issue Type: Bug
>            Reporter: Mike Laurie
>            Assignee: Dan Tran
>
> I want to supply namespace mappings to the Emitter, but I couldn't get the 
> configuration right.
> The Mappings element wouldn't work.  I'd tried this:
> {code:xml}
>   <configuration>
> ...
>     <useEmitter>true</useEmitter>
>     <mappings>
>       <mapping>
>         <namespace>http://dto.service.mycompany.com</namespace>
>         <targetPackage>com.mycompany.ws.dto.generated</targetPackage>
>       </mapping>
>       <mapping>
>         <namespace>http://soap.ws.service.mycompany.com</namespace>
>         <targetPackage>com.mycompany.ws.generated</targetPackage>
>       </mapping>
>     </mappings>
> ...
>   </configuration>
> {code}
> ...but I kept getting the following exception:
> {noformat}
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Failed to configure plugin parameters for: 
> org.codehaus.mojo:axistools-maven-plugin:1.0-SNAPSHOT
> Cause: Error loading class 'org.codehaus.mojo.axistools.Mapping'
> [INFO] 
> ------------------------------------------------------------------------
> {noformat}
> As I've learnt more about Maven, I've realised what the issue is.  When you 
> specify a list of objects in the configuration, Maven tries to create a list 
> of Java objects by looking for a class in the same package as the Mojo class.
> In this case, the configuration element is {{<mappings>}}.  The {{mappings}} 
> field of {{Wsdl2JavaMojo}} is of type {{List}}, and so Maven wants to create 
> a List to pass to the {{setMappings()}} method of {{Wsdl2JavaMojo}}.
> The {{<mappings>}} element contains subelements of type {{<mapping>}}.  The 
> crucial point is that Maven looks for a class of type {{Mapping}} _in the 
> same package as {{Wsdl2JavaMojo}}_, so it's looking for a class called 
> {{org.codehaus.mojo.axistools.Mapping}}.
> This class doesn't exist.  The Mojo is expecting a list of 
> {{org.codehaus.mojo.axistools}}*{{.axis}}*{{.Mapping}} objects.
> A solution, if you're willing, is to refactor the {{Mapping}} class to move 
> it to the {{org.codehaus.mojo.axistools}} package.
> An alternative solution is to create a "null subclass" of 
> {{org.codehaus.mojo.axistools.axis.Mapping}} in 
> {{org.codehaus.mojo.axistools}}:
> {code}
> package org.codehaus.mojo.axistools;
> /**
>  * This class is here in order to allow configuration of mapping elements in
>  * the WSDL2JavaMojo configuration.  Maven looks for the Mapping class in the
>  * same package as the Mojo, so we just duplicate that class here.
>  * @author mlaurie
>  *
>  */
> public class Mapping extends org.codehaus.mojo.axistools.axis.Mapping {
> }
> {code}
> This is is slightly less elegant but has no risk of regressions.  I'm using 
> this fix in my local version since I don't yet understand the rest of the 
> plugin code!

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to