0
votes

whilst using Maven and the cxf-codegen-plugin from apache it seems to generate code for Java ee 6. I can tell by the error message ../generated-sources/cxf/.../cxf/gen/prod/IProd.java: cannot find symbol symbol : class Action location: interface ....IProd

Action is only in jee6++

How can i force it to generate for Javaee 5? Are there any flags - cant find any.

Everything is set to Java 1.5 on computer,Java_Home and java -version gives 1.5.. i have the java EE 5 api on compilepath. The plugin in maven is set to 1.5. Still...

EDIT: Solved, see comments.

2
You also have the maven compiler plugin set to 1.5? And I think I'd rename the java 6 directory to ensure it can't be found by maven. And rename it back after the compile. Further, what version of the codegen do you use, could you post the relevant part of the pom file?extraneon
Compiler is to 1.5. I even tried removing the java 6 jdk/jre from computer, only having 1.5. Same. Using cxf 2.2.12. Could there be an jaxws dependancy somewhere that does this..northa
Found the answer after going through all my dependencys too, and didn't find anything. In the settings for the cxf-plugin (under your .m2 dir) look in cxf-parent.pom and you'll see the JAXB version is hardcoded to 2.1 (JEE6). I backed to cxf-codegen-plugin version 2.0.10 which was the last version i could find that had JAXB hardcoded to version 2.0 (JEE5). I really think there should be an option to choose if you wanna generate for JEE5 or JEE 6 without having to examining the plugin itself...northa

2 Answers

2
votes

I generate my JAX-WS classes with another plugin

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>wsimport</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <target>2.0</target>
        <packageName>some.pack.age</packageName> <!-- The name of your generated source package -->
    </configuration>

    <!--
        if you want to use a specific version of JAX-WS, you can do so like
        this
    -->
    <dependencies>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-tools</artifactId>
            <version>2.1.4</version>
        </dependency>
    </dependencies>
</plugin>

You should add your wsdl's files in

/src/wsdl/
0
votes

You need to specify the java version in you maven compiler plugin like this: (and include the "bootclasspath" if it still generates wrong code)

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
      <source>1.5</source>
      <target>1.5</target>
      <encoding>UTF-8</encoding>
      <bootclasspath>${java.home}\lib\rt.jar</bootclasspath>
    </configuration>
  </plugin>