[ 
https://issues.apache.org/jira/browse/CXF-4424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13420623#comment-13420623
 ] 

David J. M. Karlsen commented on CXF-4424:
------------------------------------------

In my top pom I declare in the properties section:

{noformat}
<properties>
...
 <jaxws.api.version>2.2</jaxws.api.version>
                <jaxb.api.version>2.2</jaxb.api.version>
                <jaxb.impl.version>2.2</jaxb.impl.version>
                <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
</properties>
{noformat}

as well as manage surefire/compiler plugin to use endorsed:

{noformat}
   <build>
                <pluginManagement>
                        <plugins>
                                <plugin>
                                        
<groupId>org.apache.maven.plugins</groupId>
                                        
<artifactId>maven-compiler-plugin</artifactId>
                                        <configuration>
                                                <compilerArguments>
                                                        
<endorseddirs>${endorsed.dir}</endorseddirs>
                                                </compilerArguments>
                                        </configuration>
                                </plugin>
                                <plugin>
                                        
<groupId>org.apache.maven.plugins</groupId>
                                        
<artifactId>maven-surefire-plugin</artifactId>
                                        <configuration>
                                                <forkMode>once</forkMode>
                                                
<argLine>-Djava.endorsed.dirs=${endorsed.dir}</argLine>
                                        </configuration>
                                </plugin>

{noformat}

in the child projects which generates code, I unpack a dependency containing 
wsdls and fork with the endorsed libs:

{noformat}
<build>
<plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-dependency-plugin</artifactId>
                                <executions>
                                        <execution>
                                                
<id>unpack-cpl-server-schemas</id>
                                                <phase>generate-sources</phase>
                                                <goals>
                                                        <goal>unpack</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>
                                        <includes>**/*.wsdl</includes>
                                        <artifactItems>
                                                <artifactItem>
                                                        
<groupId>com.edb.fs.cashpool.srv</groupId>
                                                        
<artifactId>cp-server-schemas</artifactId>
                                                        
<version>${cp.srv.version}</version>
                                                </artifactItem>
                                        </artifactItems>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.cxf</groupId>
                                <artifactId>cxf-codegen-plugin</artifactId>
                                <version>${cxf.version}</version>
                                <configuration>
                                        <fork>once</fork>
                                        
<additionalJvmArgs>-Djava.endorsed.dirs=${endorsed.dir}</additionalJvmArgs>
                                        <defaultOptions>
                                                
<catalog>${basedir}/src/main/resources/wsdl/catalog.xml</catalog>
                                                <bindingFiles>
                                                        
<bindingFile>${basedir}/src/main/resources/wsdl/jaxbbindings.xml</bindingFile>
                                                </bindingFiles>
                                                <extraargs>
                                                        <extraarg>-fe</extraarg>
                                                        
<extraarg>jaxws21</extraarg>
                                                        
<extraarg>-xjc-Xts</extraarg>
                                                        
<extraarg>-xjc-Xfluent-api</extraarg>
                                                        
<extraarg>-xjc-mark-generated</extraarg>
                                                        
<extraarg>-verbose</extraarg>
                                                </extraargs>
                                                
<validateWsdl>true</validateWsdl>
                                        </defaultOptions>
                                        
<wsdlRoot>${basedir}/src/main/resources/wsdl</wsdlRoot>
                                </configuration>
                                <executions>
                                        <execution>
                                                
<id>generate-sources-embedded</id>
                                                <phase>generate-sources</phase>
                                                <configuration>
                                                        
<wsdlRoot>${basedir}/src/main/resources/wsdl</wsdlRoot>
                                                </configuration>
                                                <goals>
                <goal>wsdl2java</goal>
                                                </goals>
                                        </execution>
                                        <execution>
                                                <id>generate-sources-cp-srv</id>
                                                <phase>generate-sources</phase>
                                                <configuration>
                                                        
<wsdlRoot>${project.build.directory}/dependency/wsdl</wsdlRoot>
                                                </configuration>
                                                <goals>
                                                        <goal>wsdl2java</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <dependencies>
                                        <dependency>
                                                
<groupId>org.apache.cxf.xjcplugins</groupId>
                                                
<artifactId>cxf-xjc-ts</artifactId>
                                                
<version>${cxf.ts.plugin.version}</version>
                                        </dependency>
                                        <dependency>
                                                
<groupId>net.java.dev.jaxb2-commons</groupId>
                                                
<artifactId>jaxb-fluent-api</artifactId>
                                                <version>2.1.8</version>
                                        </dependency>
                                        <dependency>
                                                
<groupId>com.sun.xml.bind</groupId>
                                                
<artifactId>jaxb-impl</artifactId>
                                                
<version>${jaxb.impl.version}</version>
                                        </dependency>
                                        <dependency>
                                                
<groupId>com.sun.xml.bind</groupId>
                                                
<artifactId>jaxb-xjc</artifactId>
                                                
<version>${jaxb.impl.version}</version>
                                        </dependency>
                                </dependencies>
                        </plugin>
                </plugins>
        </build>

{noformat}

And for good measure some additional WebSphere info (v8 fixpack 3), was is 
jax-ws 2.2 and jaxb2.2:
To avoid too big impact I leave my classloader to parent_first, but I add a 
shared library (set to use "isolated classloader") where I chuck in 
xmlschema-core-2.0.2.
This will override xmlschema core which would otherwise be attempted loaded 
from ./plugins/org.apache.axis2.jar and be old (1.4.x) - but have minimal 
impact on classloading to avoid a lot of potential problems.

Thanks for all help!

                
> Option for codegen plugin to fork in order to support endorsed libs
> -------------------------------------------------------------------
>
>                 Key: CXF-4424
>                 URL: https://issues.apache.org/jira/browse/CXF-4424
>             Project: CXF
>          Issue Type: Improvement
>          Components: Tooling
>    Affects Versions: 2.5.4
>         Environment: java 6
>            Reporter: David J. M. Karlsen
>              Labels: codegen, endorsed, fork
>
> In order to support endorsed libs it would be preferable to have the codegen 
> plugin fork (and support setting of java.endorsed.dirs).
> I wish to do so because my build uses a vanilla JDK6 which is JAXB 2.1 and 
> JAX-WS 2.1, but the target env is JDK6, JEE6 on WAS8 with JAXB 2.2 and JAX-WS 
> 2.2

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to