[ 
https://issues.apache.org/jira/browse/CXF-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Kulp updated CXF-2368:
-----------------------------

    Fix Version/s:     (was: Invalid)
          Summary: defaultOptions in cxf-codegen-plugin only works with 
wsdlRoot scanning  (was: NPE in cxf-codegen-plugin when trying to use 
defaultOptions with wsdlOptions)


The wiki page at:
http://cwiki.apache.org/CXF20DOC/maven-integration-and-plugin.html
 says the defaultOptions should work with the "wsdlOptions" specified wsdl, but 
it doesn't.   It only applies to wsdlOptions obtained by the directory scan 
using wsdlRoot with includes/excludes.    Not sure if this is a doc error or 
code error.   My gut feeling says it was MEANT to be a doc error, but it's 
definitely a good feature and thus is a code error.

In anycase, you can use the wsdlRoot form:

                            <wsdlRoot>src/main/wsdl</wsdlRoot>
                            <defaultOptions>
                                <validateWsdl>true</validateWsdl>
                                <bindingFiles>
                                    
<bindingFile>src/main/wsdl/bindings/bindings.xjb</bindingFile>
                                </bindingFiles>
                                <extraargs>
                                    <extraarg>-server</extraarg>
                                </extraargs>
                            </defaultOptions>



> defaultOptions in cxf-codegen-plugin only works with wsdlRoot scanning
> ----------------------------------------------------------------------
>
>                 Key: CXF-2368
>                 URL: https://issues.apache.org/jira/browse/CXF-2368
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.2.2
>         Environment: Windows XP, Eclipse 3.3.2 + m2eclipse plug-in 
>            Reporter: John McGinn
>            Assignee: Daniel Kulp
>            Priority: Minor
>         Attachments: bindingMapping.xsd, bindings.xjb, Equipment.xsd, 
> EquipmentService.wsdl, pom.xml, stacktrace.txt
>
>
> I setup the plug-in with defaultOptions + a wsdlOption and get the following 
> stack trace:
> java.lang.NullPointerException
>         at java.io.File.<init>(File.java:222)
>         at 
> org.apache.cxf.maven_plugin.WSDL2JavaMojo.mergeOptions(WSDL2JavaMojo.
> java:143)
>         at 
> org.apache.cxf.maven_plugin.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:
> 195)
> This appears to be happening at this line of code:
> private void mergeOptions(List<WsdlOption> options) {
>         File outputDirFile = testSourceRoot == null ? sourceRoot : 
> testSourceRoot;
>         for (WsdlOption o : wsdlOptions) {
>             if (o.getOutputDir() == null) {
>                 o.setOutputDir(outputDirFile);
>             }
>             
>             File file = new File(o.getWsdl()); <!------------------
> I believe this method is merging default options with wsdl options, but the 
> default options doesn't have a wsdl file those the File constructor fails.
> I put a wsdl option in my default options and the exception went away and the 
> code was generated.
> My plugin config:
>                       <plugin>
>                               <groupId>org.apache.cxf</groupId>
>                               <artifactId>cxf-codegen-plugin</artifactId>
>                               <version>2.2.2</version>
>                               <executions>
>                                       <execution>
>                                               <id>generate-sources</id>
>                                               <phase>generate-sources</phase>
>                                               <configuration>
>                                                       <wsdlOptions>
>                                                               <defaultOptions>
>                                                                       
> <validateWsdl>true</validateWsdl>
>                                                                       
> <wsdl>src/main/wsdl/EquipmentService.wsdl</wsdl>
>                                                               
> </defaultOptions>
>                                                               <wsdlOption>
>                                                                <bindingFiles> 
>                                                     
> <bindingFile>src/main/wsdl/bindings/bindings.xjb</bindingFile> 
>                                                 </bindingFiles>
>                                                                       
> <wsdl>src/main/wsdl/EquipmentService.wsdl</wsdl>
>                                                               </wsdlOption>
>                                                       </wsdlOptions>
>                                               </configuration>
>                                               <goals>
>                                                       <goal>wsdl2java</goal>
>                                               </goals>
>                                       </execution>
>                               </executions>
>                       </plugin>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to