Skip to content

Commit

Permalink
DATAJPA-12 - Simplified build setup for meta-model creation.
Browse files Browse the repository at this point in the history
Consolidated the generation of the static meta-model for test classes into the Querydsl APT plugin.
  • Loading branch information
odrotbohm committed Dec 8, 2013
1 parent 1d6806b commit 5d6e44d
Showing 1 changed file with 13 additions and 75 deletions.
88 changes: 13 additions & 75 deletions pom.xml
Expand Up @@ -144,12 +144,6 @@
<version>${hibernate}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>1.2.0.Final</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.eclipse.persistence</groupId>
Expand Down Expand Up @@ -375,7 +369,10 @@
<artifactId>apt-maven-plugin</artifactId>
<version>${apt}</version>
<configuration>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
<processors>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</processors>
</configuration>
<executions>
<execution>
Expand All @@ -385,7 +382,7 @@
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/main</outputDirectory>
<outputDirectory>target/generated-sources/annotations</outputDirectory>
</configuration>
</execution>
<execution>
Expand All @@ -395,7 +392,7 @@
<goal>test-process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/test</outputDirectory>
<testOutputDirectory>target/generated-test-sources/test-annotations</testOutputDirectory>
<options>
<querydsl.excludedClasses>
org.springframework.data.jpa.repository.util.JpaClassUtilsUnitTests.NamedUser,org.springframework.data.jpa.repository.query.ParameterBinderUnitTests.SampleEmbeddable
Expand All @@ -404,6 +401,13 @@
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>1.2.0.Final</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -413,72 +417,6 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
</plugin>

<plugin>
<!-- configuration for JPA Metamodel generation
as described here: http://stackoverflow.com/questions/18853585/maven-build-with-annotationprocessor-that-parses-files-in-src-main-java-and-gene
-->

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<!-- normal compile and generation of other classes to standard location (implicit, you shouldn't need that) -->
<id>default-compile</id>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<annotationProcessors>
<annotationProcessor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</annotationProcessor>
</annotationProcessors>
<generatedSourcesDirectory>${project.build.directory}/generated-sources/test</generatedSourcesDirectory>
<!-- generated class depends on test-scope libs, so don't compile now: proc:only DISABLES compilation of generated classes-->
<proc>only</proc>
</configuration>
</execution>
<!-- implicit test-compile:testCompile -->
</executions>

<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>1.2.0.Final</version>
</dependency>
</dependencies>
</plugin>

<!--
Adds source-dir during generate-test-sources:add-test-source
so that the path to our generated class is now known to the
compiler during test-compile:testCompile
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/test</source>
<source>${project.build.directory}/generated-test-sources/test-annotations</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit 5d6e44d

Please sign in to comment.