Skip to content
Michael Karneim edited this page Nov 1, 2016 · 3 revisions

If you need to keep the generated sources in a specific directory outside of the target directory, then configure the generatedSourcesDirectory of the maven-compiler-plugin:

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>net.karneim</groupId>
  <artifactId>pojobuilder-samples</artifactId>
  <version>1-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>PojoBuilder samples</name>

  <description>Sample usages of PojoBuilder</description>

  <dependencies>
    <dependency>
      <groupId>net.karneim</groupId>
      <artifactId>pojobuilder</artifactId>
      <version>[3.4.2,)</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!-- If you need to keep the generated sources in a specific directory 
        outside of the 'target' directory, then configure the 'generatedSourcesDirectory' 
        of the 'maven-compiler-plugin'. Otherwise just remove this 'plugin' element 
        completely. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
          <generatedSourcesDirectory>${basedir}/src/generated/java</generatedSourcesDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>