cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [1/2] cxf git commit: [CXF-7067] wsdlArtifact was not properly resolved - This closes #289
Date Fri, 30 Jun 2017 10:21:04 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes ad3670fc3 -> 7c159a791


[CXF-7067] wsdlArtifact was not properly resolved - This closes #289


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/408ffdd9
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/408ffdd9
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/408ffdd9

Branch: refs/heads/3.1.x-fixes
Commit: 408ffdd9c20d6d22dd8d390053726b18af431903
Parents: ad3670f
Author: Dennis Kieselhorst <deki@apache.org>
Authored: Fri Jun 30 12:13:50 2017 +0200
Committer: Dennis Kieselhorst <deki@apache.org>
Committed: Fri Jun 30 12:19:52 2017 +0200

----------------------------------------------------------------------
 maven-plugins/codegen-plugin/pom.xml            |  13 +-
 maven-plugins/codegen-plugin/src/it/README.md   |   5 +
 .../Cxf7067Service-1.0.0.wsdl                   |  82 ++++++++++++
 .../src/it/wsdl-artifact-resolution/pom.xml     |  68 ++++++++++
 .../cxf/maven_plugin/AbstractCodegenMoho.java   | 125 ++++++++++---------
 .../wsdl2java/WsdlOptionLoader.java             |   2 +-
 maven-plugins/pom.xml                           |   3 +
 7 files changed, 228 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/408ffdd9/maven-plugins/codegen-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/pom.xml b/maven-plugins/codegen-plugin/pom.xml
index 2d69c23..aaf593d 100644
--- a/maven-plugins/codegen-plugin/pom.xml
+++ b/maven-plugins/codegen-plugin/pom.xml
@@ -36,11 +36,6 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.maven.shared</groupId>
-            <artifactId>maven-artifact-resolver</artifactId>
-            <version>1.0</version>
-        </dependency>
-        <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-core</artifactId>
             <scope>provided</scope>
@@ -142,7 +137,7 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-plugin-plugin</artifactId>
                 <configuration>
-                    <!-- see http://jira.codehaus.org/browse/MNG-5346 -->
+                    <!-- see https://issues.apache.org/jira/browse/MNG-5346 -->
                     <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                 </configuration>
                 <executions>
@@ -163,7 +158,7 @@
                         <goals>
                             <goal>install</goal>
                         </goals>
-                        <configuration>
+                        <configuration><!-- has no effect -->
                             <localRepositoryPath>${project.build.directory}/it/repo</localRepositoryPath>
                         </configuration>
                     </execution>
@@ -172,10 +167,10 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-invoker-plugin</artifactId>
-                <version>1.9</version>
+                <version>3.0.0</version>
                 <executions>
                     <execution>
-                        <id>test-toolchains-integration</id>
+                        <id>test-integration</id>
                         <phase>integration-test</phase>
                         <goals>
                             <goal>integration-test</goal>

http://git-wip-us.apache.org/repos/asf/cxf/blob/408ffdd9/maven-plugins/codegen-plugin/src/it/README.md
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/src/it/README.md b/maven-plugins/codegen-plugin/src/it/README.md
index b202bec..f42b169 100644
--- a/maven-plugins/codegen-plugin/src/it/README.md
+++ b/maven-plugins/codegen-plugin/src/it/README.md
@@ -10,3 +10,8 @@ This project contains sample maven module using `cxf-codegen-plugin` to
generate
 - it configures `maven-toolchains-plugins` to target JDK 6
 - cxf `fork` parameter if set to true to enable toolchain detection
 - if the toolchain wasn't correctly used by the cxf-codegen-plugin`, the the build should
fail during the _compile_ phase
+
+wsdl-artifact-resolution
+------------------------
+
+Verifies that a wsdlArtifact from local repository is properly resolved for codegen.

http://git-wip-us.apache.org/repos/asf/cxf/blob/408ffdd9/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/Cxf7067Service-1.0.0.wsdl
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/Cxf7067Service-1.0.0.wsdl
b/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/Cxf7067Service-1.0.0.wsdl
new file mode 100644
index 0000000..9f6faa3
--- /dev/null
+++ b/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/Cxf7067Service-1.0.0.wsdl
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+==============================================================================
+=====  Describe all service specific name spaces.                        =====          
    
+==============================================================================
+--><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:org:apache:cxf:Cxf7067Service"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:cxf7067msg="urn:org:apache:cxf:message:Cxf7067Message"
targetNamespace="urn:org:apache:cxf:Cxf7067Service"><!--Content from Maven Artifact:
"org.apache.cxf.cxf7067:Cxf7067Service:wsdl:1.0.0" generated 2017-06-28T13:11:08CEST:-->
+<!--
+==============================================================================
+=====  Describe all data types transmitted between the client and server.=====          
   
+==============================================================================
+-->
+    <wsdl:types><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:org:apache:cxf:cxf7067:Domain-1"
targetNamespace="urn:org:apache:cxf:cxf7067:Domain-1" elementFormDefault="qualified"><!--Content
from Maven Artifact: "org.apache.cxf.cxf7067:Domain-1:xsd:1.0.0":-->
+    <xsd:complexType name="Cxf7067DomainType">
+        <xsd:sequence>
+            <xsd:element name="Id" type="xsd:string" minOccurs="1" maxOccurs="1" />
+        </xsd:sequence>
+    </xsd:complexType>
+</xsd:schema><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:org:apache:cxf:message:Cxf7067Message"
xmlns:domain="urn:org:apache:cxf:cxf7067:Domain-1" targetNamespace="urn:org:apache:cxf:message:Cxf7067Message"
elementFormDefault="qualified"><!--Content from Maven Artifact: "org.apache.cxf.cxf7067:Cxf7067Message:xsd:1.1.0":-->
+    <xsd:import namespace="urn:org:apache:cxf:cxf7067:Domain-1" />
+    <xsd:element name="Cxf7067Request" type="tns:Cxf7067RequestType" />
+    <xsd:element name="Cxf7067Response" type="tns:Cxf7067ResponseType" />
+    <xsd:complexType name="Cxf7067RequestType">
+        <xsd:sequence>
+            <xsd:element name="domain" type="domain:Cxf7067DomainType" />
+        </xsd:sequence>
+    </xsd:complexType>
+    <xsd:complexType name="Cxf7067ResponseType">
+        <xsd:sequence>
+            <xsd:element name="domain" type="domain:Cxf7067DomainType" />
+        </xsd:sequence>
+    </xsd:complexType>
+</xsd:schema></wsdl:types>
+<!--
+==============================================================================
+=====   Describe all messages transmitted between the client and server. =====          
    
+==============================================================================
+-->	
+    <wsdl:message name="cxf7067Request">
+        <wsdl:part name="cxf7067req" element="cxf7067msg:Cxf7067Request" />
+    </wsdl:message>
+    <wsdl:message name="cxf7067Response">
+        <wsdl:part name="cxf7067resp" element="cxf7067msg:Cxf7067Response" />
+    </wsdl:message>
+<!--
+==============================================================================
+=====   Describe interface and all operations.                           =====  
+==============================================================================
+-->	
+    <wsdl:portType name="Cxf7067Port">
+        <wsdl:operation name="cxf7067operation">
+            <wsdl:input message="tns:cxf7067Request" />
+            <wsdl:output message="tns:cxf7067Response" />
+        </wsdl:operation>
+    </wsdl:portType>
+<!--
+==============================================================================
+=====   Describe how the service will be implemented on the wire.        =====          
    
+==============================================================================
+-->	
+    <wsdl:binding name="Cxf7067PortBinding" type="tns:Cxf7067Port">
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+        <wsdl:operation name="cxf7067operation">
+            <soap:operation soapAction="cxf7067operation" style="document" />
+            <wsdl:input>
+                <soap:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+<!--
+==============================================================================
+=====   Describe where the service can be invoked.	                     =====           
   
+==============================================================================
+-->	
+    <wsdl:service name="Cxf7067Service">
+        <wsdl:port name="Cxf7067Port_pt" binding="tns:Cxf7067PortBinding">
+            <soap:address location="http://cxf.apache.cxf/ws/Cxf7067Service" />
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>

http://git-wip-us.apache.org/repos/asf/cxf/blob/408ffdd9/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml b/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml
new file mode 100644
index 0000000..91aaac5
--- /dev/null
+++ b/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml
@@ -0,0 +1,68 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.cxf</groupId>
+    <artifactId>cxf7067-codegen</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>jar</packaging>
+    <name>cxf7067-codegen</name>
+
+    <properties>
+        <wsdl.groupid>org.apache.cxf.cxf7067</wsdl.groupid>
+        <wsdl.artifactid>Cxf7067Service</wsdl.artifactid>
+        <wsdl.version>1.0.0</wsdl.version>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-install-plugin</artifactId>
+                <version>2.5.2</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>install-file</goal>
+                        </goals>
+                        <configuration>
+                            <groupId>${wsdl.groupid}</groupId>
+                            <artifactId>${wsdl.artifactid}</artifactId>
+                            <version>${wsdl.version}</version>
+                            <packaging>wsdl</packaging>
+                            <file>Cxf7067Service-1.0.0.wsdl</file>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <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>
+                                    <wsdlArtifact>
+                                        <groupId>${wsdl.groupid}</groupId>
+                                        <artifactId>${wsdl.artifactid}</artifactId>
+                                        <version>${wsdl.version}</version>
+                                    </wsdlArtifact>
+                                    <wsdlLocation>classpath:${wsdl.artifactid}.wsdl</wsdlLocation>
+                                    <extraargs>
+                                        <extraarg>-verbose</extraarg>
+                                        <extraarg>-validate</extraarg>
+                                    </extraargs>
+                                </wsdlOption>
+                            </wsdlOptions>
+                        </configuration>
+                        <goals>
+                            <goal>wsdl2java</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/408ffdd9/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
index 72abb0b..39f44f3 100644
--- a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
+++ b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
@@ -37,6 +37,7 @@ import java.util.Set;
 
 import org.apache.commons.lang.SystemUtils;
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.util.CollectionUtils;
 import org.apache.cxf.common.util.SystemPropertyAction;
 import org.apache.cxf.common.util.URIParserUtil;
 import org.apache.cxf.helpers.CastUtils;
@@ -68,7 +69,7 @@ import org.codehaus.plexus.util.cli.StreamConsumer;
 import org.sonatype.plexus.build.incremental.BuildContext;
 
 public abstract class AbstractCodegenMoho extends AbstractMojo {
-    
+
     /**
      * JVM/System property name holding the hostname of the http proxy.
      */
@@ -84,28 +85,28 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
      * should not use the proxy configuration.
      */
     private static final String HTTP_NON_PROXY_HOSTS = "http.nonProxyHosts";
-    
+
     /**
      * JVM/System property name holding the username of the http proxy.
      */
     private static final String HTTP_PROXY_USER = "http.proxyUser";
-    
+
     /**
      * JVM/System property name holding the password of the http proxy.
      */
     private static final String HTTP_PROXY_PASSWORD = "http.proxyPassword";
-    
+
 
     @Parameter(property = "project.build.outputDirectory", required = true)
     protected String classesDirectory;
-   
+
     /**
      * By default all maven dependencies of type "wsdl" are added to the effective wsdlOptions.
Setting this
      * parameter to true disables this functionality
      */
     @Parameter(property = "cxf.disableDependencyScan", defaultValue = "false")
     protected boolean disableDependencyScan;
-    
+
     /**
      * Disables the scanning of the wsdlRoot/testWsdlRoot directories.
      * By default, we scan for *.wsdl (see include/exclude params as well) in the wsdlRoot
@@ -114,14 +115,14 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
      */
     @Parameter(property = "cxf.disableDirectoryScan", defaultValue = "false")
     protected boolean disableDirectoryScan;
-    
+
     /**
      * Allows running the JavaToWs in a separate process. Valid values are "false", "always",
and "once" The
      * value of "true" is equal to "once"
      */
     @Parameter(defaultValue = "false")
     protected String fork;
-    
+
     /**
      * A list of wsdl files to include. Can contain ant-style wildcards and double wildcards.
Defaults to
      * *.wsdl
@@ -133,39 +134,39 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
      */
     @Parameter(property = "cxf.markerDirectory", defaultValue = "${project.build.directory}/cxf-codegen-plugin-markers")
     protected File markerDirectory;
-    
+
     /**
      * The plugin dependencies, needed for the fork mode
      */
     @Parameter(required = true, readonly = true, property = "plugin.artifacts")
     protected List<Artifact> pluginArtifacts;
-    
+
     @Parameter(required = true, property = "project")
     protected MavenProject project;
-    
+
     /**
      * Use the compile classpath rather than the test classpath for execution useful if the
test dependencies
      * clash with those of wsdl2java
      */
     @Parameter(property = "cxf.useCompileClasspath", defaultValue = "false")
     protected boolean useCompileClasspath;
-    
+
     /**
      * A list of wsdl files to exclude. Can contain ant-style wildcards and double wildcards.
      */
     @Parameter
     protected String excludes[];
-    
+
     @Parameter(property = "cxf.testWsdlRoot", defaultValue = "${basedir}/src/test/resources/wsdl")
     protected File testWsdlRoot;
-   
+
     @Parameter(property = "cxf.wsdlRoot", defaultValue = "${basedir}/src/main/resources/wsdl")
     protected File wsdlRoot;
-    
+
     @Component
     protected BuildContext buildContext;
-    
-    
+
+
     /**
      * Sets the JVM arguments (i.e. <code>-Xms128m -Xmx128m</code>) if fork is
set to <code>true</code>.
      */
@@ -189,13 +190,13 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
      */
     @Parameter(readonly = true, required = true, property = "session")
     private MavenSession mavenSession;
-    
+
     @Component
     private ProjectDependenciesResolver projectDependencyResolver;
-    
+
     @Component
     private RepositorySystem repositorySystem;
-    
+
 
     public AbstractCodegenMoho() {
         super();
@@ -213,7 +214,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             project.addTestCompileSourceRoot(getGeneratedTestRoot().getAbsolutePath());
         }
         checkResources();
-        
+
         // if this is an m2e configuration build then return immediately without doing any
work
         if (project != null && buildContext.isIncremental() && !buildContext.hasDelta(project.getBasedir()))
{
             return;
@@ -230,7 +231,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
                 "*.wsdl"
             };
         }
-       
+
         markerDirectory.mkdirs();
 
         String originalProxyHost = SystemPropertyAction.getProperty(HTTP_PROXY_HOST);
@@ -238,7 +239,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
         String originalNonProxyHosts = SystemPropertyAction.getProperty(HTTP_NON_PROXY_HOSTS);
         String originalProxyUser = SystemPropertyAction.getProperty(HTTP_PROXY_USER);
         String originalProxyPassword = SystemPropertyAction.getProperty(HTTP_PROXY_PASSWORD);
-                
+
         Bus bus = null;
         ClassLoaderSwitcher classLoaderSwitcher = null;
         try {
@@ -260,7 +261,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             } else {
                 for (GenericWsdlOption o : effectiveWsdlOptions) {
                     bus = generate(o, bus, cp);
-    
+
                     File dirs[] = o.getDeleteDirs();
                     if (dirs != null) {
                         for (int idx = 0; idx < dirs.length; ++idx) {
@@ -299,13 +300,13 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
 
         File genroot = getGeneratedSourceRoot();
         if (genroot != null) {
-            
+
             List<Resource> resources = project.getBuild().getResources();
             for (Resource r : resources) {
                 File d = new File(root, r.getDirectory());
                 if (d.equals(genroot)) {
                     sourceRoot = r;
-                } 
+                }
             }
             Resource r2 = scanForResources(genroot, sourceRoot);
             if (r2 != sourceRoot) {
@@ -320,7 +321,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
                 File d = new File(root, r.getDirectory());
                 if (d.equals(genroot)) {
                     testRoot = r;
-                } 
+                }
             }
             Resource r2 = scanForResources(genroot, testRoot);
             if (r2 != testRoot) {
@@ -385,13 +386,13 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             System.getProperties().remove(HTTP_PROXY_PASSWORD);
         }
         Proxy proxy = mavenSession.getSettings().getActiveProxy();
-        if (proxy != null && !StringUtils.isEmpty(proxy.getUsername()) 
+        if (proxy != null && !StringUtils.isEmpty(proxy.getUsername())
             && !StringUtils.isEmpty(proxy.getPassword())) {
             Authenticator.setDefault(null);
         }
     }
 
-    protected abstract Bus generate(GenericWsdlOption o, 
+    protected abstract Bus generate(GenericWsdlOption o,
                                     Bus bus, Set<URI> cp) throws MojoExecutionException;
 
     protected void addPluginArtifact(Set<URI> artifactsPath) {
@@ -442,7 +443,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
                 if (proxy.getNonProxyHosts() != null) {
                     System.setProperty(HTTP_NON_PROXY_HOSTS, proxy.getNonProxyHosts());
                 }
-                if (!StringUtils.isEmpty(proxy.getUsername()) 
+                if (!StringUtils.isEmpty(proxy.getUsername())
                     && !StringUtils.isEmpty(proxy.getPassword())) {
                     final String authUser = proxy.getUsername();
                     final String authPassword = proxy.getPassword();
@@ -459,13 +460,13 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
 
         }
     }
-    
-    protected abstract List<GenericWsdlOption> createWsdlOptionsFromScansAndExplicitWsdlOptions()

+
+    protected abstract List<GenericWsdlOption> createWsdlOptionsFromScansAndExplicitWsdlOptions()
         throws MojoExecutionException;
 
     /**
      * Recursively delete the given directory
-     * 
+     *
      * @param f
      * @return
      */
@@ -486,12 +487,12 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
 
         return true;
     }
-    
+
     protected abstract String getMarkerSuffix();
-    
+
     protected List<String> generateCommandLine(GenericWsdlOption wsdlOption)
         throws MojoExecutionException {
-        
+
         File outputDirFile = wsdlOption.getOutputDir();
         outputDirFile.mkdirs();
         URI basedir = project.getBasedir().toURI();
@@ -499,7 +500,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
         return wsdlOption.generateCommandLine(outputDirFile, basedir, wsdlURI,
                                               getLog().isDebugEnabled());
     }
-    
+
     protected void forkOnce(Set<URI> classPath, List<GenericWsdlOption> effectiveWsdlOptions)
         throws MojoExecutionException {
         List<GenericWsdlOption> toDo = new LinkedList<GenericWsdlOption>();
@@ -557,9 +558,9 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             }
         }
     }
-    
+
     protected abstract Class<?> getForkClass();
-    
+
     protected File getDoneFile(URI basedir, URI wsdlURI, String mojo) {
         String doneFileName = wsdlURI.toString();
 
@@ -571,7 +572,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             doneFileName = new javax.xml.bind.annotation.adapters.HexBinaryAdapter().marshal(cript.digest());
         } catch (Exception e) {
             //ignore,we'll try and fake it based on the wsdl
-            
+
             // Strip the basedir from the doneFileName
             if (doneFileName.startsWith(basedir.toString())) {
                 doneFileName = doneFileName.substring(basedir.toString().length());
@@ -582,16 +583,16 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
                 .replace(':', '_');
             doneFileName += ".DONE";
         }
-        
+
         return new File(markerDirectory, "." + doneFileName);
     }
 
     protected abstract File getGeneratedSourceRoot();
 
     protected abstract File getGeneratedTestRoot();
-    
-    protected void runForked(Set<URI> classPath, 
-                             String mainClassName, 
+
+    protected void runForked(Set<URI> classPath,
+                             String mainClassName,
                              String[] args) throws MojoExecutionException {
         getLog().info("Running code generation in fork mode...");
         getLog().debug("Running code generation in fork mode with args " + Arrays.asList(args));
@@ -635,7 +636,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             jar.createArchive();
 
             cmd.createArg().setValue("-jar");
-            
+
             String tmpFilePath = file.getAbsolutePath();
             if (tmpFilePath.contains(" ")) {
                 //ensure the path is in double quotation marks if the path contain space
@@ -668,7 +669,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             getLog().debug(e);
             throw new MojoExecutionException(e.getMessage(), e);
         }
-        
+
 
         String cmdLine = CommandLineUtils.toString(cmd.getCommandline());
 
@@ -691,10 +692,10 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
         }
 
     }
-    
+
     /**
      * Determine if code should be generated from the given wsdl
-     * 
+     *
      * @param wsdlOption
      * @param doneFile
      * @param wsdlURI
@@ -705,7 +706,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
     protected void createMarkerFile(GenericWsdlOption wsdlOption, File doneFile, URI wsdlURI)
throws IOException {
         doneFile.createNewFile();
     }
-   
+
     private String[] createForkOnceArgs(List<List<String>> wargs) throws MojoExecutionException
{
         try {
             File f = FileUtils.createTempFile("cxf-w2j", "args");
@@ -725,11 +726,11 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             throw new MojoExecutionException("Could not create argument file", ex);
         }
     }
-    
+
     /**
      * Try to find a file matching the wsdl path (either absolutely, relatively to the current
dir or to
      * the project base dir)
-     * 
+     *
      * @return wsdl file
      */
     public File getWsdlFile(GenericWsdlOption option, File baseDir) {
@@ -753,18 +754,18 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
         }
         return file;
     }
-    
+
     public URI getWsdlURI(GenericWsdlOption option, URI baseURI) throws MojoExecutionException
{
         String wsdlLocation = option.getUri();
         if (wsdlLocation == null) {
             throw new MojoExecutionException("No wsdl available for base URI " + baseURI);
         }
         File wsdlFile = new File(wsdlLocation);
-        return wsdlFile.exists() ? wsdlFile.toURI() 
+        return wsdlFile.exists() ? wsdlFile.toURI()
             : baseURI.resolve(URIParserUtil.escapeChars(wsdlLocation));
     }
 
-    protected void downloadRemoteWsdls(List<GenericWsdlOption> effectiveWsdlOptions)

+    protected void downloadRemoteWsdls(List<GenericWsdlOption> effectiveWsdlOptions)
         throws MojoExecutionException {
 
         for (GenericWsdlOption wsdlOption : effectiveWsdlOptions) {
@@ -774,7 +775,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             }
             Artifact wsdlArtifact = repositorySystem.createArtifactWithClassifier(wsdlA.getGroupId(),
                                                                         wsdlA.getArtifactId(),
-                                                                        wsdlA.getVersion(),

+                                                                        wsdlA.getVersion(),
                                                                         wsdlA.getType(),
                                                                         wsdlA.getClassifier());
             wsdlArtifact = resolveRemoteWsdlArtifact(wsdlArtifact);
@@ -811,13 +812,13 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             throw new IOException(
                                   "The java executable '"
                                       + javaExe
-                                      + "' doesn't exist or is not a file." 
+                                      + "' doesn't exist or is not a file."
                                       + "Verify the <javaExecutable/> parameter or
toolchain configuration.");
         }
         getLog().info("The java executable is " + javaExe.getAbsolutePath());
         return javaExe;
     }
-    
+
     private Artifact resolveRemoteWsdlArtifact(Artifact artifact) throws MojoExecutionException
{
         Artifact remoteWsdl = resolveDependentWsdl(artifact);
         if (remoteWsdl == null) {
@@ -865,10 +866,14 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
         request.setMirrors(mavenSession.getRequest().getMirrors());
         request.setProxies(mavenSession.getRequest().getProxies());
         request.setLocalRepository(mavenSession.getLocalRepository());
-        request.setRemoteRepositories(mavenSession.getRequest().getRemoteRepositories());
           
+        request.setRemoteRepositories(mavenSession.getRequest().getRemoteRepositories());
         ArtifactResolutionResult result = repositorySystem.resolve(request);
-            
-        return result.getOriginatingArtifact();
+
+        Artifact resolvedArtifact = result.getOriginatingArtifact();
+        if (resolvedArtifact == null && !CollectionUtils.isEmpty(result.getArtifacts()))
{
+            resolvedArtifact = result.getArtifacts().iterator().next();
+        }
+        return resolvedArtifact;
     }
 
     private Artifact findWsdlArtifact(Artifact targetArtifact, Collection<Artifact>
artifactSet) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/408ffdd9/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOptionLoader.java
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOptionLoader.java
b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOptionLoader.java
index 9cee2ae..4677986 100644
--- a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOptionLoader.java
+++ b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WsdlOptionLoader.java
@@ -71,7 +71,7 @@ public final class WsdlOptionLoader {
      * @param wsdlBasedir
      * @param includes file name patterns to include
      * @param excludes file name patterns to exclude
-     * @param defaultOptions options that should be used if no special file is given
+     * @param defaultOutputDir output directory that should be used if no special file is
given
      * @return list of one WsdlOption object for each wsdl found
      * @throws MojoExecutionException
      */

http://git-wip-us.apache.org/repos/asf/cxf/blob/408ffdd9/maven-plugins/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/pom.xml b/maven-plugins/pom.xml
index 433ef27..7e50bf2 100644
--- a/maven-plugins/pom.xml
+++ b/maven-plugins/pom.xml
@@ -30,6 +30,9 @@
         <version>3.1.12-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
+    <prerequisites>
+        <maven>${cxf.maven.core.version}</maven>
+    </prerequisites>
     <modules>
         <module>codegen-plugin</module>
         <module>java2ws-plugin</module>


Mime
View raw message