You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/05/19 20:00:46 UTC
svn commit: r657892 - in
/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin:
WSDL2JavaMojo.java WsdlOption.java
Author: dkulp
Date: Mon May 19 11:00:46 2008
New Revision: 657892
URL: http://svn.apache.org/viewvc?rev=657892&view=rev
Log:
[CXF-1593] Fix problems of wsdlOptions configured in the pom not being used for wsdl's in the src/main/resources/wsdl directory.
Also, move the .DONE files out of the generated directory so they aren't package
Modified:
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java
Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java?rev=657892&r1=657891&r2=657892&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java (original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java Mon May 19 11:00:46 2008
@@ -84,6 +84,13 @@
* @parameter expression="${cxf.testWsdlRoot}" default-value="${basedir}/src/test/resources/wsdl"
*/
File testWsdlRoot;
+
+ /**
+ * Directory in which the "DONE" markers are saved that
+ * @parameter expression="${cxf.markerDirectory}"
+ * default-value="${project.build.directory}/cxf-codegen-plugin-markers"
+ */
+ File markerDirectory;
/**
* Use the compile classpath rather than the test classpath for execution
@@ -119,15 +126,16 @@
}
return options;
}
-
+
public void execute() throws MojoExecutionException {
if (includes == null) {
includes = new String[] {"*.wsdl"};
- }
-
+ }
+
File classesDir = new File(classesDirectory);
classesDir.mkdirs();
-
+ markerDirectory.mkdirs();
+
List<WsdlOption> options = new ArrayList<WsdlOption>();
if (wsdlRoot != null && wsdlRoot.exists()) {
options.addAll(getWsdlOptionsFromDir(wsdlRoot, sourceRoot));
@@ -142,6 +150,19 @@
if (o.getOutputDir() == null) {
o.setOutputDir(outputDirFile);
}
+
+ File file = new File(project.getBasedir(), o.getWsdl());
+ if (file.exists()) {
+ for (WsdlOption o2 : options) {
+ File file2 = new File(o2.getWsdl());
+ if (file2.exists()
+ && file2.equals(file)) {
+ o.getExtraargs().addAll(0, o2.getExtraargs());
+ options.remove(o2);
+ break;
+ }
+ }
+ }
options.add(o);
}
}
@@ -244,7 +265,7 @@
File file = new File(wsdlOption.getWsdl());
// If URL to WSDL, replace ? and & since they're invalid chars for file names
File doneFile =
- new File(outputDirFile, "." + file.getName().replace('?', '_').replace('&', '_') + ".DONE");
+ new File(markerDirectory, "." + file.getName().replace('?', '_').replace('&', '_') + ".DONE");
boolean doWork = cgtimestamp > doneFile.lastModified();
if (!doneFile.exists()) {
doWork = true;
@@ -287,7 +308,7 @@
}
list.add(wsdlOption.getWsdl());
-
+ getLog().debug("Calling wsdl2java with args: " + list);
try {
new WSDLToJava((String[])list.toArray(new String[list.size()])).run(new ToolContext());
doneFile.createNewFile();
Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java?rev=657892&r1=657891&r2=657892&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java (original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java Mon May 19 11:00:46 2008
@@ -89,4 +89,14 @@
WsdlOption t = (WsdlOption) obj;
return t.getWsdl().equals(getWsdl());
}
+
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("WSDL: ").append(wsdl).append('\n');
+ builder.append("OutputDir: ").append(outputDir).append('\n');
+ builder.append("Extraargs: ").append(extraargs).append('\n');
+ builder.append("Packagenames: ").append(packagenames).append('\n');
+ builder.append('\n');
+ return builder.toString();
+ }
}