Index: codegen/src/test/java/xml/srcgen/template/TestSourceGenerator.java
===================================================================
--- codegen/src/test/java/xml/srcgen/template/TestSourceGenerator.java	(revision 8404)
+++ codegen/src/test/java/xml/srcgen/template/TestSourceGenerator.java	(working copy)
@@ -2,23 +2,28 @@
 
 import junit.framework.TestCase;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.exolab.castor.builder.SourceGenerator;
 import org.xml.sax.InputSource;
 
 public class TestSourceGenerator extends TestCase {
+    
+    private static final Log log = LogFactory.getLog(TestSourceGenerator.class);
 
     public void testGeneration() throws Exception {
         SourceGenerator generator = new SourceGenerator();
         String xmlSchema = getClass().getResource("test.xsd").toExternalForm();
         InputSource inputSource = new InputSource(xmlSchema);
         generator.setDestDir("./codegen/src/test/java");
+//        generator.setResourceDestinationDirectory("./codegen/src/test/resources");
         generator.setSuppressNonFatalWarnings(true);
         
         // uncomment to have JDO-specific class descriptors created 
 //        generator.setJdoDescriptorCreation(true);
         
         // uncomment to use Velocity for code generation
-//        generator.setJClassPrinterType("velocity");
+        generator.setJClassPrinterType("velocity");
         
         // uncomment the next line to set a binding file for source generation
 //      generator.setBinding(new InputSource(getClass().getResource("binding.xml").toExternalForm()));
Index: codegen/src/main/java/org/exolab/castor/builder/SourceGenerator.java
===================================================================
--- codegen/src/main/java/org/exolab/castor/builder/SourceGenerator.java	(revision 8404)
+++ codegen/src/main/java/org/exolab/castor/builder/SourceGenerator.java	(working copy)
@@ -413,6 +413,15 @@
     }
 
     /**
+     * Sets the destination directory for resources, e.g. '.castor.cdr' files.
+     *
+     * @param destDir the destination directory for resources.
+     */
+    public final void setResourceDestinationDirectory(final String destinationDirectory) {
+        _singleClassGenerator.setResourceDestinationDirectory(destinationDirectory);
+    }
+
+    /**
      * Sets whether or not to create the XML marshaling framework specific
      * methods (marshal, unmarshal, validate) in the generated classes. By
      * default, these methods are generated.
@@ -1231,6 +1240,7 @@
      * @param jClassPrinterType The string identifier of the printer to use.
      */
     public final void setJClassPrinterType(final String jClassPrinterType) {
+        LOG.info("Setting JClass printing mode " + jClassPrinterType);
         _jclassPrinterType = jClassPrinterType;
         if (_singleClassGenerator != null) {
             _singleClassGenerator.setJClassPrinterType(jClassPrinterType);
Index: codegen/src/main/java/org/exolab/castor/builder/printing/TemplateJClassPrinter.java
===================================================================
--- codegen/src/main/java/org/exolab/castor/builder/printing/TemplateJClassPrinter.java	(revision 8404)
+++ codegen/src/main/java/org/exolab/castor/builder/printing/TemplateJClassPrinter.java	(working copy)
@@ -18,6 +18,8 @@
 import java.io.File;
 import java.io.FileWriter;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.Velocity;
@@ -36,6 +38,8 @@
      */
     public static final String TEMPLATE_PACKAGE = "/org/exolab/castor/builder/printing/templates/";
 
+    private static final Log _log = LogFactory.getLog(TemplateJClassPrinter.class);
+    
     /**
      * Indicates whether Velocity has been already initialized.
      */
@@ -75,6 +79,8 @@
             initializeVelocity();
             _initialized = true;
         }
+        
+        _log.info("Printing JClass " + jClass.getName() + " using Velocity templates.");
 
         try {
 
Index: codegen/src/main/java/org/exolab/castor/builder/printing/JClassPrinterFactoryRegistry.java
===================================================================
--- codegen/src/main/java/org/exolab/castor/builder/printing/JClassPrinterFactoryRegistry.java	(revision 8404)
+++ codegen/src/main/java/org/exolab/castor/builder/printing/JClassPrinterFactoryRegistry.java	(working copy)
@@ -40,8 +40,6 @@
     /** Association between name of implementation and JClassPrinterFactory instance. */
     private Map<String, JClassPrinterFactory> _factories = new HashMap<String, JClassPrinterFactory>();
 
-    //--------------------------------------------------------------------------
-
     /**
      * Construct an instance of JClassPrinterFactoryRegistry that loads the
      * {@link JClassPrinterFactory} implementations specified in the given
@@ -75,8 +73,6 @@
         }
     }
 
-    //--------------------------------------------------------------------------
-
     /**
      * Returns the names of all the configured {@link JClassPrinterFactory}
      * implementations. A {@link JClassPrinterFactory} instance can be obtained
@@ -105,8 +101,11 @@
             _log.error(msg);
             throw new IllegalArgumentException(msg);
         }
+        
+        if (_log.isInfoEnabled()) {
+            _log.info("Returning JClassPrinterFactory with name " + name);
+        }
         return (JClassPrinterFactory) factory;
     }
 
-    //--------------------------------------------------------------------------
 }
Index: codegen/src/main/java/org/exolab/castor/builder/SourceGeneratorMain.java
===================================================================
--- codegen/src/main/java/org/exolab/castor/builder/SourceGeneratorMain.java	(revision 8404)
+++ codegen/src/main/java/org/exolab/castor/builder/SourceGeneratorMain.java	(working copy)
@@ -87,6 +87,7 @@
     private static final String ARGUMENT_LINE_SEPARATOR            = "line-separator";
     private static final String ARGUMENT_NOMARSHALL                = "nomarshall";
     private static final String ARGUMENT_PACKAGE                   = "package";
+    private static final String ARGUMENT_RESOURCES_DESTINATION_DIR = "resourcesDestination";
     private static final String ARGUMENT_SAX1                      = "sax1";
     private static final String ARGUMENT_TESTABLE                  = "testable";
     private static final String ARGUMENT_TYPES                     = "types";
@@ -173,6 +174,9 @@
     private static final String JCLASSPRINTER_TYPE_MSG =
         "Using JClass printing type ";
 
+    private static final String USING_SEPARATE_RESOURCES_DIRECTORY =
+        "Using a separate destination for resources.";
+
     /** The full set of command-line options. */
     private static final CommandLineOptions ALL_OPTIONS     = setupCommandLineOptions();
 
@@ -223,6 +227,15 @@
 
         sgen.setLineSeparator(getLineSeparator(options.getProperty(ARGUMENT_LINE_SEPARATOR)));
         sgen.setDestDir(options.getProperty(ARGUMENT_DESTINATION_DIR));
+
+        // set a resource destination if specified
+        String resourcesDestination = options.getProperty(ARGUMENT_RESOURCES_DESTINATION_DIR);
+        if (resourcesDestination != null) {
+            sgen.setResourceDestinationDirectory(resourcesDestination);
+            System.out.print("-- ");
+            System.out.println(USING_SEPARATE_RESOURCES_DIRECTORY);
+        }
+        
         sgen.setVerbose(options.getProperty(ARGUMENT_VERBOSE) != null);
         sgen.setFailOnFirstError(options.getProperty(ARGUMENT_FAIL_ON_ERROR) != null);
 
@@ -433,6 +446,10 @@
         desc = "Sets the destination output directory.";
         allOptions.addFlag(ARGUMENT_DESTINATION_DIR, "destination directory", desc, true);
 
+        //-- resources destination directory
+        desc = "Sets the destination output directory for resources.";
+        allOptions.addFlag(ARGUMENT_RESOURCES_DESTINATION_DIR, "resources destination directory", desc, true);
+
         //-- line break flag
         desc = "Sets the line separator style for the desired platform.";
         allOptions.addFlag(ARGUMENT_LINE_SEPARATOR, "(unix | mac | win)", desc, true);
Index: codegen/src/main/java/org/exolab/castor/builder/SingleClassGenerator.java
===================================================================
--- codegen/src/main/java/org/exolab/castor/builder/SingleClassGenerator.java	(revision 8404)
+++ codegen/src/main/java/org/exolab/castor/builder/SingleClassGenerator.java	(working copy)
@@ -95,7 +95,11 @@
     /** True if the user should be prompted to overwrite when a file already exists. */
     private boolean _promptForOverwrite = true;
     /** Destination directory where all our output goes. */
-    private String _destDir = null;
+    private String _destDir;
+    /**
+     * Destination directory for all resource files (e.g. .castor.cdr files).
+     */
+    private String _resourceDestinationDirectory;
     /** The line separator to use for output. */
     private String _lineSeparator = null;
     /** A flag indicating whether or not to create descriptors for the generated classes. */
@@ -196,9 +200,21 @@
      */
     public void setDestDir(final String destDir) {
        _destDir = destDir;
+       if (_resourceDestinationDirectory == null) {
+           _resourceDestinationDirectory = destDir;
+       }
     }
 
     /**
+     * Sets the destination directory for generated resources.
+     *
+     * @param destDir the destination directory.
+     */
+    public void setResourceDestinationDirectory(final String destinationDirectory) {
+       _resourceDestinationDirectory = destinationDirectory;
+    }
+
+    /**
      * Sets the line separator to use when printing the source code.
      *
      * @param lineSeparator
@@ -534,7 +550,7 @@
      */
     private void updateCDRFile(final JClass jClass, final JClass jDesc,
             final SGStateInfo sInfo, final String cdrFileName) throws IOException {
-        String entityFilename = jClass.getFilename(_destDir);
+        String entityFilename = jClass.getFilename(_resourceDestinationDirectory);
         File file = new File(entityFilename);
         File parentDirectory = file.getParentFile();
         File cdrFile = new File(parentDirectory, cdrFileName);
