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

ffang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 13e8d4e  [CXF-7674]enable Java2Wadl maven plugin to specify 
classResourceNames or basePackages
13e8d4e is described below

commit 13e8d4ee88d4fea53ff9363054104c4f42c384fd
Author: Freeman Fang <freeman.f...@gmail.com>
AuthorDate: Tue Mar 13 10:14:40 2018 +0800

    [CXF-7674]enable Java2Wadl maven plugin to specify classResourceNames or 
basePackages
---
 .../cxf/maven_plugin/javatowadl/Java2WADLMojo.java  | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git 
a/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
 
b/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
index dacd326..b1a425f 100644
--- 
a/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
+++ 
b/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
@@ -104,7 +104,6 @@ public class Java2WADLMojo extends AbstractMojo {
 
     /**
      * @parameter
-     * @required
      */
     private List<String> classResourceNames;
 
@@ -372,12 +371,20 @@ public class Java2WADLMojo extends AbstractMojo {
         return resourceClassLoader;
     }
     private List<Class<?>> loadResourceClasses() throws MojoExecutionException 
{
-        List<Class<?>> resourceClasses = new 
ArrayList<Class<?>>(classResourceNames.size());
-        for (String className : classResourceNames) {
-            try {
-                resourceClasses.add(getClassLoader().loadClass(className));
-            } catch (Exception e) {
-                throw new MojoExecutionException(e.getMessage(), e);
+        if (classResourceNames == null
+            && basePackages == null) {
+            throw new MojoExecutionException(
+                "either classResourceNames or basePackages should be 
specified");
+        }
+        List<Class<?>> resourceClasses = new ArrayList<Class<?>>(
+            classResourceNames == null ? 0 : classResourceNames.size());
+        if (classResourceNames != null) {
+            for (String className : classResourceNames) {
+                try {
+                    resourceClasses.add(getClassLoader().loadClass(className));
+                } catch (Exception e) {
+                    throw new MojoExecutionException(e.getMessage(), e);
+                }
             }
         }
         if (resourceClasses.isEmpty() && basePackages != null) {

-- 
To stop receiving notification emails like this one, please contact
ff...@apache.org.

Reply via email to