Announcement Announcement Module
Collapse
No announcement yet.
Issues with querydsl and maven pom in eclipse Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issues with querydsl and maven pom in eclipse

    Hi all,

    I'm following the example(s) used for including querydsl to the repositories and after trying numerous "solutions", I can't seem to get this issue fixed. The issue I'm having is in the POM-- I'm getting this error message at the <execution> element in my POM:

    You need to run build with JDK or have tools.jar on the classpath.If this occures during eclipse build make sure
    you run eclipse under JDK as well (com.mysema.maven:apt-maven-plugin:1.0.8rocess:default:generate-
    sources)


    My POM for the plugin looks like this:
    Code:
    <plugin>
    	<groupId>com.mysema.maven</groupId>
    		<artifactId>apt-maven-plugin</artifactId>
    		<version>1.0.8</version>
    		<dependencies>
    			<dependency>
    				<groupId>com.mysema.querydsl</groupId>
    				<artifactId>querydsl-apt</artifactId>
    				<version>${querydsl.version}</version>
    			</dependency>
    		</dependencies>
    		<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>
    I've added the -vm [PATH\TO\JDK] in my eclipse ini, I've add tools.jar into the "include libs" under the INSTALLED JRE configuration for the selected JRE, my JAVA_HOME has been configured (although not sure if this works like 'normal' in Windows 8). I mean I tried various things but I can't seem to get this working in Eclipse (4.2.2). Any help would be appreciated. TIA.

  • #2
    Quick workaround

    Originally posted by moraleslos View Post
    Hi all,

    I'm following the example(s) used for including querydsl to the repositories and after trying numerous "solutions", I can't seem to get this issue fixed. The issue I'm having is in the POM-- I'm getting this error message at the <execution> element in my POM:

    You need to run build with JDK or have tools.jar on the classpath.If this occures during eclipse build make sure
    you run eclipse under JDK as well (com.mysema.maven:apt-maven-plugin:1.0.8rocess:default:generate-
    sources)


    My POM for the plugin looks like this:
    Code:
    <plugin>
    	<groupId>com.mysema.maven</groupId>
    		<artifactId>apt-maven-plugin</artifactId>
    		<version>1.0.8</version>
    		<dependencies>
    			<dependency>
    				<groupId>com.mysema.querydsl</groupId>
    				<artifactId>querydsl-apt</artifactId>
    				<version>${querydsl.version}</version>
    			</dependency>
    		</dependencies>
    		<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>
    I've added the -vm [PATH\TO\JDK] in my eclipse ini, I've add tools.jar into the "include libs" under the INSTALLED JRE configuration for the selected JRE, my JAVA_HOME has been configured (although not sure if this works like 'normal' in Windows 8). I mean I tried various things but I can't seem to get this working in Eclipse (4.2.2). Any help would be appreciated. TIA.
    Hi. I had the same problem, and even if you solved it already, I will post it here for other users which may wind up in the same situation.
    The solution I found was to add the -vm "path to javaw.exe" to the eclipse.ini file.

    For example, for me it was:
    Code:
    -vm
    D:\jde\jdks\jdk1.6.0_37\bin\javaw.exe
    "That happens because those actions runs in the same JVM where Eclipse is running. If that JVM comes from JRE that isn’t part of JDK, there is no Java compiler (the tools.jar) around. To workaround this you can add -vm argument to Eclipse command line or eclipse.ini. "


    Source: http://wiki.eclipse.org/M2E_FAQ

    If that doesn't work, this is another solution:

    "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."

    From the Spring Data book. If eclipse doesn't detect the generated classes, add the generated-souces as a source folder to your build path.
    Last edited by adiU; Jul 15th, 2013, 09:22 AM.

    Comment


    • #3
      I don't ever recall having problems with this.

      Could the problem be that you have defined JREs and not JDKs in the Eclipse/STS "Java > Compiler > Installed JREs" preferences?

      Here's a snapshot of my settings, none of which are JREs:

      Attachment

      Since the default is a JDK, that's what will be used in the default "JRE" when initially creating a Maven run configuration:

      Attachment


      I also run STS/Eclipse on a JDK -- as a developer, I have never thought to run an IDE just on a JRE. Note that I haven't altered the STS/Eclipse "ini" file to specify a -vm value.

      In Terminal:
      Code:
      new-host-4:~ pf$ java -version
      java version "1.8.0-ea"
      Java(TM) SE Runtime Environment (build 1.8.0-ea-b97)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b39, mixed mode)
      About STS > STS Installation Details > Configuration (tab):
      Code:
      ...
      -vm
      /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/../jre/lib/server/libjvm.dylib
      eclipse.home.location=file:/Developer/Applications/springsource_3.3/sts-3.3.0.RELEASE/
      eclipse.launcher=/Developer/Applications/springsource_3.3/sts-3.3.0.RELEASE/STS.app/Contents/MacOS/STS
      eclipse.launcher.name=STS
      ...
      eclipse.vm=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/../jre/lib/server/libjvm.dylib
      eclipse.vmargs=-Dosgi.requiredJavaVersion=1.6
      -Xms40m
      -Xmx768m
      -XX:MaxPermSize=256m
      -XstartOnFirstThread
      ...
      It has been years since I used a Windows machine to develop, so I'm forgetting some details. I do seem to remember Sun's (now Oracle's) update program/utility always trying to install a JRE and make that the default Java. My memory is foggy though. Perhaps that's what is going on to mess things up?
      Attached Files

      Comment

      Working...
      X