You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Marcel Stör <ma...@frightanic.com> on 2012/03/17 10:06:59 UTC

Missing option in codegen Maven plugin?

In the past I've been using the codegen Maven plugin like this:

<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf-plugin.version}</version>
<executions>
   <execution>
     <id>generate-soap-client</id>
     <configuration>
       <wsdlOptions>
         <wsdlOption>
           <wsdl>${basedir}/src/main/wsdl/my.wsdl</wsdl>

Obviously this required the WDSL file to be present in the module.

Now I was looking into referencing the WSDL from a JAR dependency. 
Example 5 in the manual[1] shows that this can be achieved given that 
there's a Maven artifact with just the WSDL in it.
In my case, however, the WSDL is stored as a regular resource in a JAR 
file that contains other artifacts. So, it's my.jar!/my.wsdl in Java JAR 
notation.

Looking at WsdlArtifact.java[2] I saw no option which would allow me to 
achieve what I want.

It tried

<wsdlOptions>
   <wsdlOption>
     <wsdl>${settings.localRepository}/path-to-my.jar!/my.wsdl</wsdl>
   </wsdlOption>
</wsdlOptions>

which failed. I've never written a Maven plugin but from looking at 
AbstractCodegenMoho.java[3] I'm now convinced that it can't be done.

Is this correct?

Cheers,
Marcel


[1] http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
[2] 
http://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlArtifact.java
[3] 
http://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java

-- 
Marcel Stör, http://www.frightanic.com
Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Re: Missing option in codegen Maven plugin?

Posted by Marcel Stör <ma...@frightanic.com>.
On 19.03.2012 16:14, Daniel Kulp wrote:
> On Monday, March 19, 2012 02:25:09 PM David Karlsen wrote:
>> >  It would be very handy if these could be resolved as classpath:
>> >  resources like in spring.
> You MIGHT be able to with CXF.  I haven't actually tried this, but I think
> this should work:
>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-codegen-plugin</artifactId>
> <version>${cxf-plugin.version}</version>
> <dependencies>
>     <dependency>
>            <groupId>my.group.id</groupId>
>            <artifactId>myArtifactId</artifactId>
>            <version>1.0</version>
>       </dependency>
> </dependency>
> <executions>
>     <execution>
>       <id>generate-soap-client</id>
>       <configuration>
>         <wsdlOptions>
>           <wsdlOption>
>             <wsdl>classpath:my.wsdl</wsdl>
> ....
>
> Adding the dependency should throw the jar on the classpath for the plugin
> and the classpath: URL should allow CXF to load it from there.

It does work indeed, although I still don't understand /why/ this works. 
After all 'classpath:' isn't a "real" URL.

Cheers,
Marcel

-- 
Marcel Stör, http://www.frightanic.com
Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Re: Missing option in codegen Maven plugin?

Posted by Daniel Kulp <dk...@apache.org>.
On Monday, March 19, 2012 02:25:09 PM David Karlsen wrote:
> It would be very handy if these could be resolved as classpath:
> resources like in spring.

You MIGHT be able to with CXF.  I haven't actually tried this, but I think 
this should work:

<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf-plugin.version}</version>
<dependencies>
   <dependency>
          <groupId>my.group.id</groupId>
          <artifactId>myArtifactId</artifactId>
          <version>1.0</version>
     </dependency>
</dependency>
<executions>
   <execution>
     <id>generate-soap-client</id>
     <configuration>
       <wsdlOptions>
         <wsdlOption>
           <wsdl>classpath:my.wsdl</wsdl>
....

Adding the dependency should throw the jar on the classpath for the plugin 
and the classpath: URL should allow CXF to load it from there.    

Like I said, I haven't tried it before, but might be worth a shot.  :-)


Dan





> 
> 2012/3/17 Marcel Stör <ma...@frightanic.com>:
> > In the past I've been using the codegen Maven plugin like this:
> > 
> > <groupId>org.apache.cxf</groupId>
> > <artifactId>cxf-codegen-plugin</artifactId>
> > <version>${cxf-plugin.version}</version>
> > <executions>
> >  <execution>
> >    <id>generate-soap-client</id>
> >    <configuration>
> >      <wsdlOptions>
> >        <wsdlOption>
> >          <wsdl>${basedir}/src/main/wsdl/my.wsdl</wsdl>
> > 
> > Obviously this required the WDSL file to be present in the module.
> > 
> > Now I was looking into referencing the WSDL from a JAR dependency.
> > Example 5 in the manual[1] shows that this can be achieved given that
> > there's a Maven artifact with just the WSDL in it.
> > In my case, however, the WSDL is stored as a regular resource in a JAR
> > file that contains other artifacts. So, it's my.jar!/my.wsdl in Java
> > JAR notation.
> > 
> > Looking at WsdlArtifact.java[2] I saw no option which would allow me to
> > achieve what I want.
> > 
> > It tried
> > 
> > <wsdlOptions>
> >  <wsdlOption>
> >    <wsdl>${settings.localRepository}/path-to-my.jar!/my.wsdl</wsdl>
> >  </wsdlOption>
> > </wsdlOptions>
> > 
> > which failed. I've never written a Maven plugin but from looking at
> > AbstractCodegenMoho.java[3] I'm now convinced that it can't be done.
> > 
> > Is this correct?
> > 
> > Cheers,
> > Marcel
> > 
> > 
> > [1]
> > http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
> > [2]
> > http://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin/s
> > rc/main/java/org/apache/cxf/maven_plugin/WsdlArtifact.java [3]
> > http://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin/s
> > rc/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
> > 
> > --
> > Marcel Stör, http://www.frightanic.com
> > Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
> > O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: Missing option in codegen Maven plugin?

Posted by David Karlsen <da...@gmail.com>.
It would be very handy if these could be resolved as classpath:
resources like in spring.

2012/3/17 Marcel Stör <ma...@frightanic.com>:
> In the past I've been using the codegen Maven plugin like this:
>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-codegen-plugin</artifactId>
> <version>${cxf-plugin.version}</version>
> <executions>
>  <execution>
>    <id>generate-soap-client</id>
>    <configuration>
>      <wsdlOptions>
>        <wsdlOption>
>          <wsdl>${basedir}/src/main/wsdl/my.wsdl</wsdl>
>
> Obviously this required the WDSL file to be present in the module.
>
> Now I was looking into referencing the WSDL from a JAR dependency. Example 5
> in the manual[1] shows that this can be achieved given that there's a Maven
> artifact with just the WSDL in it.
> In my case, however, the WSDL is stored as a regular resource in a JAR file
> that contains other artifacts. So, it's my.jar!/my.wsdl in Java JAR
> notation.
>
> Looking at WsdlArtifact.java[2] I saw no option which would allow me to
> achieve what I want.
>
> It tried
>
> <wsdlOptions>
>  <wsdlOption>
>    <wsdl>${settings.localRepository}/path-to-my.jar!/my.wsdl</wsdl>
>  </wsdlOption>
> </wsdlOptions>
>
> which failed. I've never written a Maven plugin but from looking at
> AbstractCodegenMoho.java[3] I'm now convinced that it can't be done.
>
> Is this correct?
>
> Cheers,
> Marcel
>
>
> [1] http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
> [2]
> http://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlArtifact.java
> [3]
> http://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
>
> --
> Marcel Stör, http://www.frightanic.com
> Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org



-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen