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

Christian Schneider edited comment on CXF-2275 at 10/16/09 3:01 PM:
--------------------------------------------------------------------

I have some problems with the current approach. The way I implemented resolving 
a wsdl by it´s artifact name does not work well with a binding.xml file. 
Currently the wsdl artifact is simply resolved and read from the local 
repository. The problem is that you have to give a wsdlLocation in the 
binding.xml. As the position of the local repository depends on the config of 
the developer this is not possible. Of course I could copy the wsdl to a place 
below the build directory but this would require even more configuration. 

So I somehow think that I have recreated to much functionality of the 
dependencies plugin. I have thought how this problem can be solved cleaner and 
came to the following solution:

One or more wsdls are specified as normal dependencies of type wsdl like this:
<dependency>
 <groupId>org.apache.cxf.systests.wsdl_maven</groupId>
 <artifactId>cxf-systests-java2ws</artifactId>
 <version>2.3.0-SNAPSHOT</version>
 <type>wsdl</type>
</dependency>

Then the dependency plugin is configured like this:
<plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-dependency-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <id>copy</id>
                                                <phase>generate-sources</phase>
                                                <goals>
                                                        
<goal>copy-dependencies</goal>
                                                </goals>
                                                <configuration>
                                                        
<includeTypes>wsdl</includeTypes>
                                                        
<stripVersion>true</stripVersion>
                                                </configuration>
                                        </execution>
                                </executions>
</plugin>

This copies all wsdl dependencies to the directory target/dependency. The 
version number is stripped from the file name. So the name does not change when 
the version increases.

Then the normal codegen plugin can be used:
                        <plugin>
                                <groupId>org.apache.cxf</groupId>
                                <artifactId>cxf-codegen-plugin</artifactId>
                                <version>${project.version}</version>
                                <executions>
                                        <execution>
                                                <id>generate-sources</id>
                                                <phase>generate-sources</phase>
                                                <configuration>
                                                        <wsdlOptions>
                                                                <wsdlOption>
                                                                        
<wsdl>${project.build.directory}\dependency\cxf-systests-java2ws.wsdl</wsdl>
                                                                </wsdlOption>
                                                        </wsdlOptions>
                                                </configuration>
                                                <goals>
                                                        <goal>wsdl2java</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>

In this way a binding file can be included. The wsdlLocation in the binding 
file can be set relatively as the path is now known.

So I am in doubt if it is better to follow the wsdlArtifact way and make it 
copy the wsdl or simply remove the feature again and simply explain how to use 
the dependency plugin for this.

Any ideas?

      was (Author: ch...@die-schneider.net):
    I have some problems with the current approach. The way I implemented 
resolving a wsdl by it´s artifact name does not work well with a binding.xml 
file. Currently the wsdl artifact is simply resolved and read from the local 
repository. The problem is that you have to give a wsdlLocation in the 
binding.xml. As the position of the local repository depends on the config of 
the developer this is not possible. Of course I could copy the wsdl to a place 
below the build directory but this would require even more configuration. 

So I somehow think that I have recreated to much functionality of the 
dependencies plugin. I have thought how this problem can be solved cleaner and 
came to the following solution:

One or more wsdls are specified as normal dependencies of type wsdl like this:
<dependency>
 <groupId>org.apache.cxf.systests.wsdl_maven</groupId>
 <artifactId>cxf-systests-java2ws</artifactId>
 <version>2.3.0-SNAPSHOT</version>
 <type>wsdl</type>
</dependency>

Then the dependency plugin is configured like this:
<plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-dependency-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <id>copy</id>
                                                <phase>generate-sources</phase>
                                                <goals>
                                                        
<goal>copy-dependencies</goal>
                                                </goals>
                                                <configuration>
                                                        
<includeTypes>true</includeTypes>
                                                        
<stripVersion>true</stripVersion>
                                                </configuration>
                                        </execution>
                                </executions>
</plugin>

This copies all wsdl dependencies to the directory target/dependency. The 
version number is stripped from the file name. So the name does not change when 
the version increases.

Then the normal codegen plugin can be used:
                        <plugin>
                                <groupId>org.apache.cxf</groupId>
                                <artifactId>cxf-codegen-plugin</artifactId>
                                <version>${project.version}</version>
                                <executions>
                                        <execution>
                                                <id>generate-sources</id>
                                                <phase>generate-sources</phase>
                                                <configuration>
                                                        <wsdlOptions>
                                                                <wsdlOption>
                                                                        
<wsdl>${project.build.directory}/dependency/cxf-systests-java2ws.wsdl</wsdl>
                                                                </wsdlOption>
                                                        </wsdlOptions>
                                                </configuration>
                                                <goals>
                                                        <goal>wsdl2java</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>

In this way a binding file can be included. The wsdlLocation in the binding 
file can be set relatively as the path is now known.

So I am in doubt if it is better to follow the wsdlArtifact way and make it 
copy the wsdl or simply remove the feature again and simply explain how to use 
the dependency plugin for this.

Any ideas?
  
> Maven plugins: Support reading WSDLs from Maven repository
> ----------------------------------------------------------
>
>                 Key: CXF-2275
>                 URL: https://issues.apache.org/jira/browse/CXF-2275
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>    Affects Versions: 2.2.2
>            Reporter: Trygve Laugstøl
>            Assignee: Christian Schneider
>             Fix For: 2.3
>
>
> The Maven plugins should support reading WSDL files directly from a Maven 
> repository to make it easier to consume WSDLs in a repository. Currently it 
> is required to use the dependency plugin or similar to copy the WSDL from the 
> repository to target/ to process it.

-- 
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