users@jaxb.java.net

Re: Maven 2 Jaxb2 plugin available.

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 15 May 2006 15:50:39 -0700

Sorry for the delay. JavaOne preparation took my time away.

The trace message indicates that XJC isn't informed of any "produces"
set. I haven't verified that this works, but I'd suggest changing the
relevant line to:

> // Configure production artifacts to determine generation
> FileSet products = new FileSet();
>
> File outDir = generateDirectory;
> if (generatePackage != null)
> {
> outDir = new File(outDir,generatePackage.replace('.', File.separatorChar));
> }
> products.setDir(outDir);
> products.setIncludes("**/*.java");
> xjc2TaskAdapter.addConfiguredProduces(products);

I attached the diff. If you want me to commit, I can do so, too.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com


Index: src/main/java/com/sun/tools/xjc/maven2/XJCMojo.java
===================================================================
RCS file: /cvs/jaxb2-sources/jaxb-maven2-plugin/src/main/java/com/sun/tools/xjc/maven2/XJCMojo.java,v
retrieving revision 1.9
diff -u -r1.9 XJCMojo.java
--- src/main/java/com/sun/tools/xjc/maven2/XJCMojo.java 14 Apr 2006 01:02:57 -0000 1.9
+++ src/main/java/com/sun/tools/xjc/maven2/XJCMojo.java 15 May 2006 22:49:04 -0000
@@ -275,16 +275,14 @@
 
         // Configure production artifacts to determine generation
         FileSet products = new FileSet();
- StringBuilder fullPath = new StringBuilder(256);
 
- fullPath.append(generateDirectory);
+ File outDir = generateDirectory;
         if (generatePackage != null)
         {
- fullPath.append(File.separator)
- .append(generatePackage.replace('.', File.separatorChar));
+ outDir = new File(outDir,generatePackage.replace('.', File.separatorChar));
         }
- products.setDir(new File(fullPath.toString()));
- products.addFilename(createFilenameSelector("*.java"));
+ products.setDir(outDir);
+ products.setIncludes("**/*.java");
         xjc2TaskAdapter.addConfiguredProduces(products);
 
         // Run the XJC compiler for each schema