You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2017/09/25 07:19:19 UTC

[cxf] branch 3.1.x-fixes updated: [CXF-7067]cxf-codegen-plugin version 3.1.x fails to download wsdlArtifact

This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch 3.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.1.x-fixes by this push:
     new d1407c4  [CXF-7067]cxf-codegen-plugin version 3.1.x fails to download wsdlArtifact
d1407c4 is described below

commit d1407c4ab37104b95dac8c7db50802563b1eac81
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Mon Sep 25 15:12:22 2017 +0800

    [CXF-7067]cxf-codegen-plugin version 3.1.x fails to download wsdlArtifact
    
    (cherry picked from commit e92adddad6a93bb40ea5cf19578bc907042a1185)
    
    Conflicts:
    	maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java
---
 .../src/it/wsdl-artifact-resolution/pom.xml        |  1 +
 maven-plugins/wadl2java-plugin/pom.xml             | 18 +++++++
 maven-plugins/wadl2java-plugin/src/it/settings.xml | 45 ++++++++++++++++++
 .../src/it/wsdl-artifact-resolution/cxf7511.wadl   | 26 ++++++++++
 .../src/it/wsdl-artifact-resolution/pom.xml        | 55 +++++++++++++---------
 .../wadlto/AbstractCodeGeneratorMojo.java          |  8 +++-
 6 files changed, 128 insertions(+), 25 deletions(-)

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
index 91aaac5..4c93c94 100644
--- a/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml
+++ b/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml
@@ -20,6 +20,7 @@
                 <version>2.5.2</version>
                 <executions>
                     <execution>
+                        <phase>initialize</phase>
                         <goals>
                             <goal>install-file</goal>
                         </goals>
diff --git a/maven-plugins/wadl2java-plugin/pom.xml b/maven-plugins/wadl2java-plugin/pom.xml
index 3215427..de205fe 100644
--- a/maven-plugins/wadl2java-plugin/pom.xml
+++ b/maven-plugins/wadl2java-plugin/pom.xml
@@ -128,6 +128,24 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-invoker-plugin</artifactId>
+                <version>3.0.0</version>
+                <executions>
+                    <execution>
+                        <id>test-integration</id>
+                        <phase>integration-test</phase>
+                        <goals>
+                            <goal>integration-test</goal>
+                        </goals>
+                        <configuration>
+                            <settingsFile>src/it/settings.xml</settingsFile>
+                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
     <profiles>
diff --git a/maven-plugins/wadl2java-plugin/src/it/settings.xml b/maven-plugins/wadl2java-plugin/src/it/settings.xml
new file mode 100644
index 0000000..d29dc39
--- /dev/null
+++ b/maven-plugins/wadl2java-plugin/src/it/settings.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<settings>
+  <profiles>
+    <profile>
+      <id>it-repo</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <repositories>
+        <repository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </pluginRepository>
+        <pluginRepository>
+          <id>local.it</id>
+          <url>file://@project.build.directory@/it/repo</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+</settings>
diff --git a/maven-plugins/wadl2java-plugin/src/it/wsdl-artifact-resolution/cxf7511.wadl b/maven-plugins/wadl2java-plugin/src/it/wsdl-artifact-resolution/cxf7511.wadl
new file mode 100644
index 0000000..914e68f
--- /dev/null
+++ b/maven-plugins/wadl2java-plugin/src/it/wsdl-artifact-resolution/cxf7511.wadl
@@ -0,0 +1,26 @@
+<application xmlns="http://wadl.dev.java.net/2009/02" xmlns:xs="http://www.w3.org/2001/XMLSchema" >
+	<grammars />
+	<resources>
+		<resource id="Test1" path="/1">
+			<method name="PUT" >
+				<request>
+					<param name="standalone" style="query" type="xs:boolean" />
+					<representation mediaType="multipart/mixed">
+						<param name="action" style="query" type="xs:anyType" />
+						<param name="sources" style="query" type="xs:anyType" required="false" />
+					</representation>
+				</request>
+			</method>
+		</resource>
+		<resource id="Test2" path="/2">
+			<method name="PUT" >
+				<request>
+					<param name="snapshot" style="query" type="xs:boolean" required="true" />
+					<representation mediaType="application/json">
+						<param name="flow" style="plain" type="xs:anyType" required="true" />
+					</representation>
+				</request>
+			</method>
+		</resource>
+	</resources>
+</application>
diff --git a/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml b/maven-plugins/wadl2java-plugin/src/it/wsdl-artifact-resolution/pom.xml
similarity index 53%
copy from maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml
copy to maven-plugins/wadl2java-plugin/src/it/wsdl-artifact-resolution/pom.xml
index 91aaac5..4578127 100644
--- a/maven-plugins/codegen-plugin/src/it/wsdl-artifact-resolution/pom.xml
+++ b/maven-plugins/wadl2java-plugin/src/it/wsdl-artifact-resolution/pom.xml
@@ -2,17 +2,26 @@
   <modelVersion>4.0.0</modelVersion>
 
     <groupId>org.apache.cxf</groupId>
-    <artifactId>cxf7067-codegen</artifactId>
+    <artifactId>cxf7511-codegen</artifactId>
     <version>1.0.0-SNAPSHOT</version>
     <packaging>jar</packaging>
-    <name>cxf7067-codegen</name>
+    <name>cxf7511-codegen</name>
 
     <properties>
-        <wsdl.groupid>org.apache.cxf.cxf7067</wsdl.groupid>
-        <wsdl.artifactid>Cxf7067Service</wsdl.artifactid>
-        <wsdl.version>1.0.0</wsdl.version>
+        <wadl.groupid>org.apache.cxf.cxf7511</wadl.groupid>
+        <wadl.artifactid>cxf7511wadl</wadl.artifactid>
+        <wadl.version>1.0.0</wadl.version>
     </properties>
 
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+            <version>@project.version@</version>
+        </dependency>
+    </dependencies>
+
     <build>
         <plugins>
             <plugin>
@@ -20,45 +29,45 @@
                 <version>2.5.2</version>
                 <executions>
                     <execution>
+                        <phase>initialize</phase>
                         <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>
+                            <groupId>${wadl.groupid}</groupId>
+                            <artifactId>${wadl.artifactid}</artifactId>
+                            <version>${wadl.version}</version>
+                            <packaging>wadl</packaging>
+                            <file>cxf7511.wadl</file>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
             <plugin>
                 <groupId>org.apache.cxf</groupId>
-                <artifactId>cxf-codegen-plugin</artifactId>
+                <artifactId>cxf-wadl2java-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>
+                            <wadlOptions>
+                                <wadlOption>
+                                    <wadlArtifact>
+                                        <groupId>${wadl.groupid}</groupId>
+                                        <artifactId>${wadl.artifactid}</artifactId>
+                                        <version>${wadl.version}</version>
+                                        <type>wadl</type>
+                                    </wadlArtifact>
                                     <extraargs>
                                         <extraarg>-verbose</extraarg>
-                                        <extraarg>-validate</extraarg>
                                     </extraargs>
-                                </wsdlOption>
-                            </wsdlOptions>
+                                </wadlOption>
+                            </wadlOptions>
                         </configuration>
                         <goals>
-                            <goal>wsdl2java</goal>
+                            <goal>wadl2java</goal>
                         </goals>
                     </execution>
                 </executions>
diff --git a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java
index 9f5aed5..dce585e 100644
--- a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java
+++ b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java
@@ -35,6 +35,7 @@ import java.util.Set;
 import org.apache.commons.lang.SystemUtils;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
+import org.apache.cxf.common.util.CollectionUtils;
 import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.maven_plugin.common.DocumentArtifact;
 import org.apache.cxf.maven_plugin.common.ForkOnceCodeGenerator;
@@ -200,8 +201,11 @@ public abstract class AbstractCodeGeneratorMojo extends AbstractMojo {
         request.setLocalRepository(mavenSession.getLocalRepository());
         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;
     }
 
     protected void downloadRemoteDocs(List<WadlOption> effectiveOptions) throws MojoExecutionException {

-- 
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <co...@cxf.apache.org>'].