You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christian Schneider <ch...@die-schneider.net> on 2010/01/24 11:36:37 UTC

different behaviour of wsdl2java.bat and maven codegen plugin

Hi all,

I have a problem generating java code from a wsdl in cxf 2.2.5. It seems 
the command line tool and the maven plugin accept different options.
I am especially missing the -Xts option in maven. I also would like the 
simple binding "xjc -extension simpleBinding.schemalet abc.xsd". Like 
described in 
http://weblogs.java.net/blog/kohsuke/archive/2006/03/simple_and_bett.html
  Is that possible?

When I call the command line tool wsdl2java -xjc-X 
"C:\java\apache-cxf-2.2.5\samples\wsdl_first\wsdl\CustomerService.wsdl"
I get the following list of arguments:
----------------
WSDLToJava Error:
avaliable plugin options:
   -Xts                 : Activate plugin to add a toString() method to 
generated classes
   -Xts:style:multiline : Have toString produce multi line output
   -Xts:style:simple    : Have toString produce single line terse output

   -Xbug671             : Activate plugin to map package names that 
contain keywords

   -Xbg                 : Generate getters methods for Booleans
   -Xdv                 : Initialize fields mapped from elements with 
their default values
   -Xinject-code      :  inject specified Java code fragments into the 
generated code
   -Xlocator          :  enable source location support for generated code
   -Xsync-methods     :  generate accessor methods with the 
'synchronized' keyword
   -mark-generated    :  mark the generated code as 
@javax.annotation.Generated
   -episode <FILE>    :  generate the episode file for separate compilation
----------------


When I do the same with the codgen plugin I get:
--------------
avaliable plugin options:
   -Xinject-code      :  inject specified Java code fragments into the 
generated code
   -Xlocator          :  enable source location support for generated code
   -Xsync-methods     :  generate accessor methods with the 
'synchronized' keyword
   -mark-generated    :  mark the generated code as 
@javax.annotation.Generated
   -episode <FILE>    :  generate the episode file for separate compilation
----------------
I would have thought that the same options are accepted. Is it possible 
to somehow use the -Xts option from maven?

Below you find the plugin section in my maven pom
-----------------------
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/wsdl/CustomerService.wsdl</wsdl>
<extraargs>
<extraarg>-xjc-X</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>

-- 

Christian Schneider
---
http://www.liquid-reality.de


Re: different behaviour of wsdl2java.bat and maven codegen plugin

Posted by Christian Schneider <ch...@die-schneider.net>.
Thanks for the hint. I have added some documentation to the wiki page of 
the codegen plugin:
http://cwiki.apache.org/confluence/display/CXF20DOC/Maven+cxf-codegen-plugin+%28WSDL+to+Java%29

Greetings

Christian

Am 25.01.2010 17:58, schrieb Daniel Kulp:
> Christian,
>
> You need to add the appropriate JAXB XJC plugin to the deps of the codegen
> plugin.  This should be done in your "root poms" pluginManagement section.
>
> <plugin>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-codegen-plugin</artifactId>
> <version>${cxf.version}</version>
> <dependencies>
>      <dependency>
>          <groupId>org.apache.cxf</groupId>
>          <artifactId>cxf-xjc-ts</artifactId>
>          <version>${cxf.version}</version>
>       </dependency>
> </dependencies>
> <executions>
> .....
> </executions>
> </plugin>
>    

-- 

Christian Schneider
---
http://www.liquid-reality.de


Re: different behaviour of wsdl2java.bat and maven codegen plugin

Posted by Daniel Kulp <dk...@apache.org>.
Christian,

This is kind of why I want to pull our xjc plugins and such into a
sub-project of CXF.   A kind of "goal" would be to have a place similar 
to jaxb2-commons for jaxb xjc plugins to find a home, but a place that 
is managed better than jaxb2-commons and deploys to central and 
such for releases.     Even things like the jaxb-xjc-plugin thing that by 
default brings in an ancient version of xjc/jaxb are quite annoying.

If we do decide to pull them into a subproject (for those that didn't 
hear about that thought, see the thread:
http://old.nabble.com/Radical-structure-reorg-thoughts-for-2.3....-td27313076.html
), one consideration might be to send an email on the jaxb2-commons 
list mentioning that we have done so and encourage folks to participate 
here.

If they are Apache licensed, we could definitely grab them if we need
them.  I'd PREFER to try and get the developers from there to do
a grant if we could, but a lot of the stuff there is quite old so even 
getting a hold of the devs might be hard.

Dan


On Wed January 27 2010 5:04:19 pm Christian Schneider wrote:
> Hi Dan,
> 
> for some time I have searched for a jaxb extension that generates a
> contructor with all attributes. I have now found two implementations
> from jaxb2-commons value constructor or even more interesting fluent api.
> 
> https://jaxb2-commons.dev.java.net/value-constructor/
> https://jaxb2-commons.dev.java.net/fluent-api/
> 
> The problem is that fluent api only seems to be available in the
> java.net repo and value-constructor seems to be not available in maven.
> So my question is do you know any other source where to get them for
> maven? If not then I propose to add the most interesting jaxb2-commons
> extensions to the central repo or even to cxf commons xjc. They seem to
> have the apache license so it should be ok to do so.
> 
> Greetings
> 
> Christian
> 
> Am 25.01.2010 17:58, schrieb Daniel Kulp:
> > Christian,
> >
> > You need to add the appropriate JAXB XJC plugin to the deps of the
> > codegen plugin.  This should be done in your "root poms" pluginManagement
> > section.
> >
> > <plugin>
> > <groupId>org.apache.cxf</groupId>
> > <artifactId>cxf-codegen-plugin</artifactId>
> > <version>${cxf.version}</version>
> > <dependencies>
> >      <dependency>
> >          <groupId>org.apache.cxf</groupId>
> >          <artifactId>cxf-xjc-ts</artifactId>
> >          <version>${cxf.version}</version>
> >       </dependency>
> > </dependencies>
> > <executions>
> > .....
> > </executions>
> > </plugin>
> >
> > That will allow the plugin to pick up that plugin.
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: different behaviour of wsdl2java.bat and maven codegen plugin

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Dan,

for some time I have searched for a jaxb extension that generates a 
contructor with all attributes. I have now found two implementations 
from jaxb2-commons value constructor or even more interesting fluent api.

https://jaxb2-commons.dev.java.net/value-constructor/
https://jaxb2-commons.dev.java.net/fluent-api/

The problem is that fluent api only seems to be available in the 
java.net repo and value-constructor seems to be not available in maven. 
So my question is do you know any other source where to get them for 
maven? If not then I propose to add the most interesting jaxb2-commons 
extensions to the central repo or even to cxf commons xjc. They seem to 
have the apache license so it should be ok to do so.

Greetings

Christian

Am 25.01.2010 17:58, schrieb Daniel Kulp:
> Christian,
>
> You need to add the appropriate JAXB XJC plugin to the deps of the codegen
> plugin.  This should be done in your "root poms" pluginManagement section.
>
> <plugin>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-codegen-plugin</artifactId>
> <version>${cxf.version}</version>
> <dependencies>
>      <dependency>
>          <groupId>org.apache.cxf</groupId>
>          <artifactId>cxf-xjc-ts</artifactId>
>          <version>${cxf.version}</version>
>       </dependency>
> </dependencies>
> <executions>
> .....
> </executions>
> </plugin>
>
> That will allow the plugin to pick up that plugin.
>    

-- 

Christian Schneider
---
http://www.liquid-reality.de


Re: different behaviour of wsdl2java.bat and maven codegen plugin

Posted by Daniel Kulp <dk...@apache.org>.
Christian,

You need to add the appropriate JAXB XJC plugin to the deps of the codegen 
plugin.  This should be done in your "root poms" pluginManagement section.

<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<dependencies>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-xjc-ts</artifactId>
        <version>${cxf.version}</version>
     </dependency>
</dependencies>
<executions>
.....
</executions>
</plugin>

That will allow the plugin to pick up that plugin.   

On the command line, we have all the plugins we have already on the classpath 
so they are picked up.  With maven, you need to add them if you need them.

Dan


On Sun January 24 2010 5:36:37 am Christian Schneider wrote:
> Hi all,
> 
> I have a problem generating java code from a wsdl in cxf 2.2.5. It seems
> the command line tool and the maven plugin accept different options.
> I am especially missing the -Xts option in maven. I also would like the
> simple binding "xjc -extension simpleBinding.schemalet abc.xsd". Like
> described in
> http://weblogs.java.net/blog/kohsuke/archive/2006/03/simple_and_bett.html
>   Is that possible?
> 
> When I call the command line tool wsdl2java -xjc-X
> "C:\java\apache-cxf-2.2.5\samples\wsdl_first\wsdl\CustomerService.wsdl"
> I get the following list of arguments:
> ----------------
> WSDLToJava Error:
> avaliable plugin options:
>    -Xts                 : Activate plugin to add a toString() method to
> generated classes
>    -Xts:style:multiline : Have toString produce multi line output
>    -Xts:style:simple    : Have toString produce single line terse output
> 
>    -Xbug671             : Activate plugin to map package names that
> contain keywords
> 
>    -Xbg                 : Generate getters methods for Booleans
>    -Xdv                 : Initialize fields mapped from elements with
> their default values
>    -Xinject-code      :  inject specified Java code fragments into the
> generated code
>    -Xlocator          :  enable source location support for generated code
>    -Xsync-methods     :  generate accessor methods with the
> 'synchronized' keyword
>    -mark-generated    :  mark the generated code as
> @javax.annotation.Generated
>    -episode <FILE>    :  generate the episode file for separate compilation
> ----------------
> 
> 
> When I do the same with the codgen plugin I get:
> --------------
> avaliable plugin options:
>    -Xinject-code      :  inject specified Java code fragments into the
> generated code
>    -Xlocator          :  enable source location support for generated code
>    -Xsync-methods     :  generate accessor methods with the
> 'synchronized' keyword
>    -mark-generated    :  mark the generated code as
> @javax.annotation.Generated
>    -episode <FILE>    :  generate the episode file for separate compilation
> ----------------
> I would have thought that the same options are accepted. Is it possible
> to somehow use the -Xts option from maven?
> 
> Below you find the plugin section in my maven pom
> -----------------------
> <plugin>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-codegen-plugin</artifactId>
> <version>${cxf.version}</version>
> <executions>
> <execution>
> <id>generate-sources</id>
> <phase>generate-sources</phase>
> <configuration>
> <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
> <wsdlOptions>
> <wsdlOption>
> <wsdl>${basedir}/src/main/wsdl/CustomerService.wsdl</wsdl>
> <extraargs>
> <extraarg>-xjc-X</extraarg>
> </extraargs>
> </wsdlOption>
> </wsdlOptions>
> </configuration>
> <goals>
> <goal>wsdl2java</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog