Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven build problems with spring-data-jpa and querydsl

I've got an Eclipse Maven project for spring-data-jpa and QueryDsl.

I seem to have a problem with the maven-apt-plugin where if I do a mvn clean followed by a mvn install, it tries to "process" files that reference the QueryDsl generated files, but these generated files have not yet been built so I get multiple "cannot find symbol" errors.

If then have to do another mvn install, everything is ok as the generated files now exist.

Does this maven-apt-plugin need to process every file in my project, or can I give it a specified directory ?

Note: Im using JDK6, Eclipse Indigo, M2E 1.0.100

My POM is:

<project>
  ....
  <build>
    <plugins>
      <plugin>
        <groupId>com.mysema.maven</groupId>
        <artifactId>maven-apt-plugin</artifactId>
        <version>1.0.2</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>process</goal>
            </goals>
            <configuration>
              <outputDirectory>target/generated-sources</outputDirectory>
              <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  ....
</project>
like image 754
Alex Avatar asked Nov 09 '11 21:11

Alex


1 Answers

Alex, try to define build-helper:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.7</version>
    <executions>
        <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>add-source</goal>
                <goal>add-test-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>target/generated-sources</source>
                    <source>src/main/java</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>
like image 51
ILX Avatar answered Sep 30 '22 16:09

ILX