[CXF-7674]enable Java2Wadl maven plugin to specify classResourceNames or basePackages
@@ -104,7 +104,6 @@ public class Java2WADLMojo extends AbstractMojo {
/**
* @parameter
- * @required
*/
private List<String> classResourceNames;
@@ -372,7 +371,14 @@ public class Java2WADLMojo extends AbstractMojo {
return resourceClassLoader;
}
private List<Class<?>> loadResourceClasses() throws MojoExecutionException {
- List<Class<?>> resourceClasses = new ArrayList<Class<?>>(classResourceNames.size());
+ 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));
@@ -380,6 +386,7 @@ public class Java2WADLMojo extends AbstractMojo {
throw new MojoExecutionException(e.getMessage(), e);
}
}
+ }
if (resourceClasses.isEmpty() && basePackages != null) {
try {
List<Class<? extends Annotation>> anns = new ArrayList<Class<? extends Annotation>>();
