Eclipse issue with Maven build and JDK when generating Qclasses in Querydsl

I did it finally! I've tried so many option like this and this, but no luck. Then I read this comment that saved my life, really, thank you! I follow this solution and its working suddenly! should be accepted answer in my case.

I copied tools.jar from C:\Program Files\Java\jdk1.8.0_151\lib to C:\Program Files\Java\jre1.8.0_151\lib, after i execute mvn clean install – @julio mulcue burbano


SOLUTION 1

Following this link

"The Maven APT plugin has a known issue that prevents its usage directly from Eclipse. Eclipse users must create the Querydsl query types manually by running the command mvn generate-sources at command prompt."

So i execute the command line mvn generate-sources in my project floder with console cmd and i got my Qclasses generated.

SOLUTION 2 from @informatik01 comment

we can explicitly specified JVM in the eclipse.ini like that :

-vm
C:\Program Files\Java\jdk1.7.0_45\bin\javaw.exe

-vmargs
...

The -vm option must occur before the -vmargs option and for more info read @informatik01 comment below.


You could try with this in the pom:

<plugin>
  <groupId>com.mysema.maven</groupId>
  <artifactId>apt-maven-plugin</artifactId>
  <version>1.0.6</version>
  <executions>
    <execution> 
      <goals>
        <goal>process</goal>
      </goals>
      <configuration>
        <outputDirectory>target/generated-sources/java</outputDirectory>
        <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
      </configuration>
    </execution>
  </executions>
  <dependencies>
    <dependency>
      <groupId>com.sun</groupId>
      <artifactId>tools</artifactId>
      <version>1.7</version>
      <scope>system</scope>
      <systemPath>${java.home}/../lib/tools.jar</systemPath>
     </dependency>
  </dependencies>
</plugin>

And see if it changes anything. It should force tools.jar in the build path.


Edit. since that didn't help, try specifying

-vm 
D:/work/Java/jdk1.6.0_13/bin/javaw.exe

in eclipse.ini (separate lines are important), as explained in this thread.