You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Lorenzo Bolzani <l....@gmail.com> on 2011/02/25 18:08:58 UTC

Weird wsdl2java behaviour

Hi, while working in the issue posted this morning I found a strange
behavior in wsdl2java.

If I modify a generated class, for example removing a field and adding a
comment, and run the wsdl2java from maven again the class is regenerated
with no errors but the field is not added(!).
In this way I can keep removing as many attributes as I want and the class
gets regenerated in this new version.

If I delete the java source file the next maven run regenerates the class
correctly.

What's wrong?

This is a problem because one of the schema definition is from another
project. If I modify that project and rebuild this one the changes are not
"seen" in the other one.

If I clean up the directory with the generated sources the build brakes
because the test classes no longer find the client classes to invoke the web
service.

To break the loop I have to delete generated files, comment test classes,
and rebuild.

:(

Any suggestion?


Bye

Lorenzo

Re: Weird wsdl2java behaviour

Posted by Lorenzo Bolzani <l....@gmail.com>.
2011/2/25 Daniel Kulp <dk...@apache.org>

>
> Since running wsdl2java can be pretty slow, it only runs if it detects that
> the wsdl it is targetting has changed since the code was generated.
> However, the wsdlOption element in the config for the maven plugin does
> have a
> dependencies list where you can list additional things to check.  Example:
>
> <dependencies>
>        <dependency>
>
> ${basedir}/target/generated/src/main/resources/wsdl/type_test/types.xd
>        </dependency>
> </dependencies>
>
> That may work for you.  I'm not really sure though.
>


Hi Daniel, I tried but it did not work. Eventually I "fixed" it deleting all
generated resources and running the compile twice. Here are the relevant
parts from the pom.xml


            <!-- Configure compile plugin to run twice -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
                <executions>
                    <execution>
                        <id>default-compile</id>
                    </execution>
                    <execution>
                        <id>build-generated-wsdl-client-sources</id>
                        <!-- the phase right after "process-classes" where
client sources have been generated
                            see: maven lifecycle
                        -->
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/generated/</directory>
                            <includes>
                                <include>**/*.java</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>


Now the pom part to generate the wsdl and the client classes for one service
is 130 lines long...I hate maven! :|



Thanks, bye

Lorenzo

Re: Weird wsdl2java behaviour

Posted by Daniel Kulp <dk...@apache.org>.
Since running wsdl2java can be pretty slow, it only runs if it detects that 
the wsdl it is targetting has changed since the code was generated.    
However, the wsdlOption element in the config for the maven plugin does have a 
dependencies list where you can list additional things to check.  Example:

<dependencies>
        <dependency>
               ${basedir}/target/generated/src/main/resources/wsdl/type_test/types.xd
        </dependency>
</dependencies>

That may work for you.  I'm not really sure though.


On Friday 25 February 2011 12:08:58 PM Lorenzo Bolzani wrote:
> Hi, while working in the issue posted this morning I found a strange
> behavior in wsdl2java.
> 
> If I modify a generated class, for example removing a field and adding a
> comment, and run the wsdl2java from maven again the class is regenerated
> with no errors but the field is not added(!).
> In this way I can keep removing as many attributes as I want and the class
> gets regenerated in this new version.
> 
> If I delete the java source file the next maven run regenerates the class
> correctly.
> 
> What's wrong?
> 
> This is a problem because one of the schema definition is from another
> project. If I modify that project and rebuild this one the changes are not
> "seen" in the other one.
> 
> If I clean up the directory with the generated sources the build brakes
> because the test classes no longer find the client classes to invoke the
> web service.
> 
> To break the loop I have to delete generated files, comment test classes,
> and rebuild.
> 
> :(
> 
> Any suggestion?
> 
> 
> Bye
> 
> Lorenzo

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