diff -up melati-0.7.8/poem/pom.xml~ melati-0.7.8/poem/pom.xml
--- melati-0.7.8/poem/pom.xml~	2009-11-19 18:43:33.000000000 +0100
+++ melati-0.7.8/poem/pom.xml	2009-11-20 08:21:56.000000000 +0100
@@ -167,15 +167,6 @@
         </configuration>
        </execution>
      </executions>
-     <dependencies>
-      <dependency>
-       <groupId>org.melati</groupId>
-       <artifactId>poem</artifactId>
-        <!-- Bootstrap issues when we go up a version-->
-       <version>0.7.8-RC1-SNAPSHOT</version>
-       <!--version>${project.version}</version-->
-      </dependency>
-     </dependencies>
     </plugin>
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
diff -up melati-0.7.8/maven-dsd-plugin/src/main/java/org/melati/poem/prepro/DSD.java~ melati-0.7.8/maven-dsd-plugin/src/main/java/org/melati/poem/prepro/DSD.java
--- melati-0.7.8/maven-dsd-plugin/src/main/java/org/melati/poem/prepro/DSD.java~	2007-08-28 20:08:38.000000000 +0200
+++ melati-0.7.8/maven-dsd-plugin/src/main/java/org/melati/poem/prepro/DSD.java	2009-12-11 08:20:39.000000000 +0100
@@ -47,6 +47,8 @@ package org.melati.poem.prepro;
 
 import java.util.Enumeration;
 import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
 import java.io.FileNotFoundException;
 import java.io.InputStreamReader;
 import java.io.Writer;
@@ -58,6 +60,9 @@ import java.io.Reader;
 import java.io.BufferedReader;
 import java.io.StreamTokenizer;
 import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.MalformedURLException;
 
 /**
  * The <code>DSD</code> class is an application which parses a DSD
@@ -73,6 +78,11 @@ import java.io.IOException;
 
 public class DSD {
 
+  /**
+   * Additional classpath elements to locate Poem.dsd, or null.
+   */
+  private List dsdClassPathElements; 
+
   static final String autogenStamp =
   "// Do not edit this file!  " +
   "It was generated by Melati POEM's DSD preprocessor.";
@@ -123,7 +133,67 @@ public class DSD {
   */
   public DSD(String file) throws IOException, ParsingDSDException,
                             IllegalityException, ResourceNotFoundException {
-    this(file, new TableNamingStore(), true);
+	  this(file, true);
+  }
+
+  /**
+  * Constructor.
+  *
+  * @param file  the name of the DSD file to open
+  * @param includePoem whether to include the Poem tables
+  * @throws ResourceNotFoundException
+  *    if a DSD file cannot be found
+  * @throws ParsingDSDException
+  *    if an unexpected token is encountered
+  * @throws IllegalityException
+  *    if a semantic incoherence is detected
+  * @throws IOException
+  *    if a problem with the file system is encountered
+  */
+  public DSD(String file, boolean includePoem) throws IOException, ParsingDSDException,
+                            IllegalityException, ResourceNotFoundException {
+	  this(file, includePoem, (List)null);
+  }
+
+ /**
+  * Constructor supporting build and test of poem.
+  *
+  * <p>The second parameter may be the return value of MavenProject.getRuntimeClasspathElements(), or indeed any other such list, or null.
+  * Anticipated usage is in MelatiDsdProcessorMojo hence the package visibility.</p>
+  *
+  * @param file  the name of the DSD file to open
+  * @param dsdClassPathElements Optional list of places where PoemDatabase may be found
+  * @throws ResourceNotFoundException
+  *    if a DSD file cannot be found
+  * @throws ParsingDSDException
+  *    if an unexpected token is encountered
+  * @throws IllegalityException
+  *    if a semantic incoherence is detected
+  * @throws IOException
+  *    if a problem with the file system is encountered
+  */
+  DSD(String file, List dsdClassPathElements) throws IOException, ParsingDSDException,
+                            IllegalityException, ResourceNotFoundException {
+    this(file, true, dsdClassPathElements);
+  }
+
+ /**
+  * Constructor.
+  *
+  * @param file  the name of the DSD file to open
+  * @param dsdClassPathElements Optional list of places where PoemDatabase may be found
+  * @throws ResourceNotFoundException
+  *    if a DSD file cannot be found
+  * @throws ParsingDSDException
+  *    if an unexpected token is encountered
+  * @throws IllegalityException
+  *    if a semantic incoherence is detected
+  * @throws IOException
+  *    if a problem with the file system is encountered
+  */
+  DSD(String file, boolean includePoem, List dsdClassPathElements) throws IOException, ParsingDSDException,
+                            IllegalityException, ResourceNotFoundException {
+    this(file, new TableNamingStore(), true, dsdClassPathElements);
   }
 
  /**
@@ -132,6 +206,7 @@
   * @param file  the name of the DSD file to open
   * @param names a {@link TableNamingStore} containing names encountered so far
   * @param includePoem whether to include the Poem tables
+  * @param dsdClassPathElements Optional list of places where PoemDatabase may be found
   * @throws ResourceNotFoundException
   *    if a DSD file cannot be found
   * @throws ParsingDSDException
@@ -141,9 +212,10 @@
   * @throws IOException
   *    if a problem with the file system is encountered
   */
-  public DSD(String file, TableNamingStore names, boolean includePoem)
+  public DSD(String file, TableNamingStore names, boolean includePoem, List dsdClassPathElements)
       throws ResourceNotFoundException, ParsingDSDException,
              IllegalityException, IOException {
+    this.dsdClassPathElements = dsdClassPathElements;
     nameStore = names;
     dsdFile = new File(file);
     String dsdFileName = dsdFile.getName();
@@ -162,7 +216,7 @@ public class DSD {
     /* Read in the default Poem tables, if appropriate */
     if (includePoem && !"Poem".equals(projectName)) {
       DSD poemDSD = new DSD(filePath("org.melati.poem.Poem.dsd"),
-                            nameStore, false);
+                            nameStore, false, dsdClassPathElements);
       Vector poemTables = poemDSD.tablesInPackage;
       for(int i = 0; i < poemTables.size(); i++)
         tablesInDatabase.addElement(poemTables.elementAt(i));
@@ -217,7 +271,7 @@ public class DSD {
         expect(tokens, ';');
         tokens.nextToken();
 
-        DSD dsd = new DSD(filePath(importDSD), nameStore, false);
+        DSD dsd = new DSD(filePath(importDSD), nameStore, false, dsdClassPathElements);
         importedDSDs.addElement(dsd);
 
         Vector packageTables = dsd.tablesInPackage;
@@ -634,8 +688,31 @@ public class DSD {
     String databaseName = StringUtils.capitalised(fileName.toLowerCase()) +
                             "Database";
     Class database;
+    ClassLoader cl = getClass().getClassLoader();
+    if (dsdClassPathElements == null || dsdClassPathElements.size() == 0) {
+      // System.err.println("Nothing added to classpath");
+      // new Throwable().printStackTrace();
+    } else {
+      ArrayList urls = new ArrayList();
+      for (int i = 0; i < dsdClassPathElements.size(); i++) {
+        String p = (String)dsdClassPathElements.get(i);
+        try {
+          urls.add(new File(p).toURI().toURL());
+		   System.err.println("Added to classpath:" + p);
+        } catch (IllegalArgumentException iae) {
+          assert false : "The file is first converted to an absolute URI";
+        } catch (MalformedURLException mue) {
+          // I guess the system dependent file syntax is causing problems
+          // if this occurs, but it probably does not. So let's just skip this
+          // one. Worst case is a ResourceNotFoundException below unless the
+          // DSD appears more than once on the path.
+		   // System.err.println("Does not convert to URL:" + p);
+        } 
+      }
+      cl = new URLClassLoader((URL[])urls.toArray(new URL[urls.size()]), cl);
+    }
     try {
-      database = Class.forName(packageNameLocal + "." + databaseName);
+      database = Class.forName(packageNameLocal + "." + databaseName, true, cl);
     } catch (Exception e) {
       throw new ResourceNotFoundException(resource,
                   "I can't find the database class associated with this "+
diff -up melati-0.7.8/maven-dsd-plugin/src/main/java/org/melati/poem/prepro/MelatiDsdProcessorMojo.java~ melati-0.7.8/maven-dsd-plugin/src/main/java/org/melati/poem/prepro/MelatiDsdProcessorMojo.java
--- melati-0.7.8/maven-dsd-plugin/src/main/java/org/melati/poem/prepro/MelatiDsdProcessorMojo.java~	2007-08-20 11:03:33.000000000 +0200
+++ melati-0.7.8/maven-dsd-plugin/src/main/java/org/melati/poem/prepro/MelatiDsdProcessorMojo.java	2009-12-01 00:24:30.000000000 +0100
@@ -46,7 +46,9 @@ package org.melati.poem.prepro;
 
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;

+import java.util.List; 
 import java.io.File;
 
 /**
@@ -57,6 +58,16 @@ import java.io.File;
  * @phase process-sources
  */
 public class MelatiDsdProcessorMojo extends AbstractMojo {
+
+  /**
+   * The maven project.
+   *
+   * @parameter expression="${project}"
+   * @required
+   * @readonly
+   */
+  private MavenProject project; 
+
   /**
    * Location of the dsd.
    * 
@@ -165,7 +177,14 @@
     if (doIt) {
       DSD dsd;
       try {
-        dsd = new DSD(dsdPath);
+        // The idea is to debug e.g. the melati-example-contacts build but I have given up.
+        // The main thing is that adding the compile classpath elements solves the problem 
+        // for the melati module. Obviously it is a hack if it does not work generally.
+        // printClasspath(project.getCompileClasspathElements(), "CompileClasspathElements");
+        // printClasspath(project.getTestClasspathElements(), "TestClasspathElements");
+        // printClasspath(project.getRuntimeClasspathElements(), "RuntimeClasspathElements");
+        // printClasspath(project.getSystemClasspathElements(), "SystemClasspathElements");
+        dsd = new DSD(dsdPath, project.getCompileClasspathElements());
         dsd.generateJava();
       } catch (Exception e) {
         throw new MojoExecutionException("Error processing DSD", e);
@@ -173,6 +189,14 @@
     }
   }
 
+  private void printClasspath(List classpathElements, String label) {
+    if (classpathElements == null) {
+      System.err.println(label + " is null");
+    } else {
+      System.err.println(label + ": " + classpathElements);
+    }
+  }
+
   private String existingDsdFileName(String dir, String dsdFileName)
       throws MojoExecutionException {
     String modelDirName = dir + "poem/";
diff -up melati-0.7.8/maven-dsd-plugin/pom.xml~ melati-0.7.8/maven-dsd-plugin/pom.xml
--- melati-0.7.8/maven-dsd-plugin/pom.xml~	2008-02-22 14:45:13.000000000 +0100
+++ melati-0.7.8/maven-dsd-plugin/pom.xml	2009-12-01 19:33:21.000000000 +0100
@@ -23,6 +23,11 @@
       <artifactId>maven-plugin-api</artifactId>
       <version>2.0</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.4</version>
+    </dependency>
   </dependencies>
   <build>
    <resources>
diff -up melati-0.7.8/melati-example-contacts/src/main/java/org/melati/example/contacts/generated/ContactsDatabaseBase.java~ melati-0.7.8/melati-example-contacts/src/main/java/org/melati/example/contacts/generated/ContactsDatabaseBase.java
--- melati-0.7.8/melati-example-contacts/src/main/java/org/melati/example/contacts/generated/ContactsDatabaseBase.java~	2006-05-22 17:11:03.000000000 +0200
+++ melati-0.7.8/melati-example-contacts/src/main/java/org/melati/example/contacts/generated/ContactsDatabaseBase.java	2010-01-03 18:53:01.000000000 +0100
@@ -1,4 +1,7 @@
 // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
+// Well, with this edit-by-patch we modify the datestamp so that no attempt is
+// made to regenerate with the broken DSD plugin during rpmbuild. This assumes
+// the latest generated sources are committed to CVS, which may not be the case.
 
 package org.melati.example.contacts.generated;
 
