Just FYI, this change has two parts to it:
1.) Allow us to use the precise wsdl2java goal to generate the JAX-WS
artifacts, instead of needing to rely on the "mvn generate-sources"
scope. This was a clear bug that James apparently fixed, and the one I
was primarily concerned about. This portion needs to stay.
2.) James placed in an enhancement to allow us to process multiple
WSDLs in Maven at once, like Metro has I believe. Now *this* portion
may need further tweaking and fixing, as it is still quite new. I have
not gotten much into this area, so don't have much to comment here.
Regards,
Glen
Am Donnerstag, den 03.01.2008, 11:01 -0500 schrieb Daniel Kulp:
>
> This commit is breaks all kinds of things and I think needs to be rolled
> back. I certainly need to roll it back off the 2.0.4 branch.
>
> Problems I see:
> 1) By default, it grabs *.wsdl from src/main/resources/wsdl to process.
> This isn't backwords compatible at all so I need to roll that off the
> 2.0.4 branch. For example, the 2.0.4 testutils fails to build with it
> as there are wsdls in there (the catalog stuff) that cannot/shouldnot be
> processed.
>
> 2) It also processes all the stuff in src/test/resources/wsdl, but
> outputs that to the source generated area, not test generated area.
> Thus, the test stuff would get packaged with the source. That's not
> good. Most likely, the getWsdlOptionsFromDir call should set an output
> dir into a new field of WsdlOptions.
>
> 3) defaults should be set with default-value tags on the @parameter so
> they are documented. They shouldnt be in the code. Probably should
> have a separate var for testWsdlRoot.
>
> 4) They probably should be a File object, not a String.
>
>
> For example:
> /**
> * @parameter expression="${wsdl2java.wsdlRoot}"
> default-value="${basedir}/src/main/resources/wsdl"
> */
> File wsdlRoot;
>
> That would provide a good default, but also also setting it via a command
> line:
>
> mvn codegen-plugin:wsdl2java -Dwsdl2java.wsdlRoot=target/foo
>
> Actually, sourceRoot and testSourceRoot should probably have expressions
> to make them settable on the command line as well.
>
>
> Looking at it, I'm wondering if we should make the mojo abstract and make
> two subclasses: one for source and one for tests.
> wsdl2java
> wsdl2javatests
> or similar. It would definitely simplify it quite a bit.
>
> Dan
>
>
>
> mmao wrote:
> >
> > Author: mmao
> > Date: Fri Dec 28 23:18:46 2007
> > New Revision: 607390
> >
> > URL: http://svn.apache.org/viewvc?rev=607390&view=rev
> > Log:
> > CXF-1246
> > Support run wsdl2java in the style of
> > mvn
> > org.apache.cxf:cxf-codegen-plugin:2.1-incubator-SNAPSHOT:wsdl2java
> >
> >
> > Modified:
> >
> >
> incubator/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
> >
> >
> incubator/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
> >
> > Modified:
> >
> incubator/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
> > URL:
> >
> http://svn.apache.org/viewvc/incubator/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java?rev=607390&r1=607389&r2=607390&view=diff
> >
> ==============================================================================
> > ---
> >
> incubator/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
> > (original)
> > +++
> >
> incubator/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
> > Fri Dec 28 23:18:46 2007
> > @@ -87,6 +87,16 @@
> > */
> > boolean useCompileClasspath;
> >
> > + private List<WsdlOption> getWsdlOptionsFromDir(final File root)
> > throws MojoExecutionException {
> > + List<WsdlOption> options = new ArrayList<WsdlOption>();
> > + for (WsdlOption o : new WsdlOptionLoader().load(root)) {
> > + if (!options.contains(o)) {
> > + options.add(o);
> > + }
> > + }
> > + return options;
> > + }
> > +
> > public void execute() throws MojoExecutionException {
> > String outputDir = testSourceRoot == null ? sourceRoot :
> > testSourceRoot;
> > File outputDirFile = new File(outputDir);
> > @@ -95,22 +105,25 @@
> > File classesDir = new File(classesDirectory);
> > classesDir.mkdirs();
> >
> > -
> > - if (wsdlRoot != null) {
> > - List<WsdlOption> options = new ArrayList<WsdlOption>();
> > - if (wsdlOptions != null) {
> > - options.addAll(Arrays.asList(wsdlOptions));
> > + List<WsdlOption> options = new ArrayList<WsdlOption>();
> > + if (wsdlRoot == null) {
> > + File sourceWsdlRoot = new File(project.getBasedir(),
> > "/src/main/resources/wsdl");
> > + if (sourceWsdlRoot.exists()) {
> > + options.addAll(getWsdlOptionsFromDir(sourceWsdlRoot));
> > }
> > -
> > - for (WsdlOption o : new WsdlOptionLoader().load(wsdlRoot))
> {
> > - if (!options.contains(o)) {
> > - options.add(o);
> > - }
> > +
> > + File testWsdlRoot = new File(project.getBasedir(),
> > "/src/test/resources/wsdl");
> > + if (testWsdlRoot.exists()) {
> > + options.addAll(getWsdlOptionsFromDir(testWsdlRoot));
> > }
> > - wsdlOptions = options.toArray(new
> > WsdlOption[options.size()]);
> > }
> >
> > - if (wsdlOptions == null) {
> > + if (wsdlOptions != null) {
> > + options.addAll(Arrays.asList(wsdlOptions));
> > + }
> > + wsdlOptions = options.toArray(new WsdlOption[options.size()]);
> > +
> > + if (wsdlOptions.length == 0) {
> > getLog().info("Nothing to generate");
> > return;
> > }
> >
> > Modified:
> >
> incubator/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
> > URL:
> >
> http://svn.apache.org/viewvc/incubator/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java?rev=607390&r1=607389&r2=607390&view=diff
> >
> ==============================================================================
> > ---
> >
> incubator/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
> > (original)
> > +++
> >
> incubator/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
> > Fri Dec 28 23:18:46 2007
> > @@ -38,14 +38,16 @@
> > private static final String WSDL_BINDINGS = "-binding-?\\d*.xml$";
> >
> > public List<WsdlOption> load(String wsdlRoot) throws
> > MojoExecutionException {
> > - File wsdlBasedir;
> > - if (wsdlRoot == null) {
> > + return load(new File(wsdlRoot));
> > + }
> > +
> > + public List<WsdlOption> load(File wsdlBasedir) throws
> > MojoExecutionException {
> > + if (wsdlBasedir == null) {
> > return new ArrayList<WsdlOption>();
> > }
> > - wsdlBasedir = new File(wsdlRoot);
> >
> > if (!wsdlBasedir.exists()) {
> > - throw new MojoExecutionException(wsdlRoot + " not
> exists");
> > + throw new MojoExecutionException(wsdlBasedir + " not
> > exists");
> > }
> >
> > return findJobs(wsdlBasedir, getWsdlFiles(wsdlBasedir));
> >
> >
> >
> >
>
>
>
>
>