0

I have a maven project where I use the jaxws-maven-plugin as follows:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>1.12</version>
    <executions>
        <execution>
            <goals>
                <goal>wsimport</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <wsdlDirectory>src/main/wsdl</wsdlDirectory>
    <wsdlFiles>
            <wsdlFile>MyService.wsdl</wsdlFile>
        </wsdlFiles>
        <sourceDestDir>src/main/java</sourceDestDir>
        <extension>true</extension>
    </configuration>
</plugin>

The project runs with jdk1.5.0_22 and jboss 4.2.2.GA. The problem that I have is that the jaxws-maven-plugin generates code which is not compatible with jdk1.5.0_22 anymore. As a consequence, I get the following error at compilation:

cannot find symbol : method getPort(javax.xml.namespace.QName,java.lang.Class<com.example.MyService>,javax.xml.ws.WebServiceFeature[]) location: class javax.xml.ws.Service

The project has to run with the above configuration (jdk1.5.0_22 and jboss 4.2.2.GA) under any circumstances, so I cannot upgrade to jdk1.6.

Is there any way I can overcome this issue?

Thanks in advance for your help.

2 Answers2

0

See here
You are missing:

 <!-- Don't forget Java 5!! -->
 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
       <source>1.5</source>
       <target>1.5</target>
    </configuration>
 </plugin>
Tagir Valeev
  • 97,161
  • 19
  • 222
  • 334
win_wave
  • 1,498
  • 11
  • 9
0

Thanks win_wave for your comment. In fact I've already setup the maven compiler this way too.

Anyway, I was able to solve this issue on my own. In fact the wsimport goal of the jaxws-maven-plugin has a configuration parameter which is called target.

I've setup my plugin as follows now:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>1.12</version>
    <executions>
        <execution>
            <goals>
                <goal>wsimport</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        ...
        <target>2.0</target>
        ...
    </configuration>
</plugin>

By setting the target parameter to 2.0, the plugin will generate code which is compatible with jax-ws 2.0 and thus also with jdk 1.5.