Hi,

I am new to Maven and would like integrate Castor to generate source
code from XML Schema files. 

I found a Castor plug-in for Maven 2.0 at
http://svn.mojo.codehaus.org/trunk/mojo/castor-maven-plugin which I
built and installed the plug-in in my local maven repository. 

I have the attached pom.xml which uses the plug-in. Code generation
works fine. The code is generated in target/generated-sources/castor.

However, I have been unable to find out how to tell Maven to include the
generated source files in the build. When I call 'mvn compile' I get
error messages from the compiler stating that the generated classes were
not found.

I'd be glad about any hints.


Christoph
<project 
  xmlns="http://maven.apache.org/POM/4.0.0"; 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>

  <modelVersion>4.0.0</modelVersion>
  <groupId>...</groupId>
  <artifactId>...</artifactId>
  <packaging>jar</packaging>
  <version>1.0</version>
  <name>...</name>

  <build>
    <!--sourceDirectory>src/main/java</sourceDirectory>
    <sourceDirectory>${project.build.directory}/generated-sources/castor/src</sourceDirectory-->
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>castor-maven-plugin</artifactId>
        <version>1.0</version>
        <configuration>
          <schema>${basedir}/src/main/xml-schemas/my.xsd</schema>
          <dest>${project.build.directory}/generated-sources/castor/src</dest>
          <packaging>com.mycompany.schemas</packaging>
          <marshal>false</marshal>
          <tstamp>${project.build.directory}/generated-sources/castor</tstamp>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>castor</groupId>
      <artifactId>castor</artifactId>
      <version>0.9.7</version>
    </dependency>

  </dependencies>
</project>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to