1

I cannot generate querydsl Q classes in eclipse. if anyone has any help, it would be greatly appreciated. Below are methods I've tried and snippets from my pom.xml file

I've copied suggested plugin setup located here:

https://github.com/querydsl/apt-maven-plugin/wiki/m2e-usage

M2E and having maven generated source folders as eclipse source folders

I've made sure that Maven is installed and changed my eclipse .ini file to run off of the JDK as mentioned here:

You need to run build with JDK or have tools.jar on the classpath Eclipse issue with Maven build and JDK when generating Qclasses in Querydsl Eclipse issue with Maven build and JDK when generating Qclasses in Querydsl

I've gone to the project folder and ran mvn generate-sources and added the folder to the classpath. Still, the project cannot find any Q classes that are generated and I do not see any generated within the target folder. If anyone has any insights, I would be greatly appreciative. Thanks

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry exported="true" kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.0">
        <attributes>
            <attribute name="owner.project.facets" value="jst.web"/>
        </attributes>
    </classpathentry>
    <classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
            <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" output="target/classes" path="src/main/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" path="target/generated-sources"/>
    <classpathentry kind="src" path="src/main/webapp/WEB-INF/tld"/>
    <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="target/classes"/>
</classpath>



<properties>
 <java-version>1.8</java-version>
 <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 <querydsl.version>3.7.4</querydsl.version>

 </properties>

 <dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-framework-bom</artifactId>
            <version>4.2.5.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
 </dependencyManagement>


 <dependencies>
 <!--  <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
    </dependency>-->

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
    </dependency>

 <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
    </dependency>


 <!-- web services -->
 <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-core</artifactId>
        <version>2.2.4.RELEASE</version>
    </dependency>

    <!-- security -->
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>4.0.4.RELEASE</version>
    </dependency>

    <dependency>
 <groupId>org.springframework.security</groupId>
 <artifactId>spring-security-taglibs</artifactId>
 <version>4.0.4.RELEASE</version>
 </dependency>

 <dependency>
 <groupId>org.springframework.security</groupId>
 <artifactId>spring-security-config</artifactId>
 <version>4.0.4.RELEASE</version>
 </dependency>

  <!-- HDIV SECURITY 
  <dependency>
      <groupId>org.hdiv</groupId>
      <artifactId>hdiv-core</artifactId>
      <version>2.1.3</version>
  </dependency>

  <dependency>
      <groupId>org.hdiv</groupId>
      <artifactId>hdiv-config</artifactId>
      <version>2.1.3</version>
  </dependency>

  <dependency>
      <groupId>org.hdiv</groupId>
      <artifactId>hdiv-spring-mvc</artifactId>
      <version>2.1.3</version>
  </dependency>

  <dependency>
      <groupId>org.hdiv</groupId>
      <artifactId>hdiv-jstl-taglibs-1.2</artifactId>
      <version>2.1.3</version>
  </dependency>-->

 <dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-core</artifactId>
   <version>5.1.0.Final</version>
 </dependency>

 <dependency>
 <groupId>org.hibernate</groupId>
 <artifactId>hibernate-validator</artifactId>
 <version>5.2.4.Final</version>
 </dependency>


 <dependency>
 <groupId>mysql</groupId>
 <artifactId>mysql-connector-java</artifactId>
 <version>5.1.38</version>
 </dependency>


 <!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-commons-core 
 <dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-commons-core</artifactId>
    <version>1.4.1.RELEASE</version>
 </dependency>-->

    <!--  <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-releasetrain</artifactId>
            <version>Gosling-SR4</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>-->

    <dependency>
 <groupId>javax.mail</groupId>
 <artifactId>javax.mail-api</artifactId>
 <version>1.5.5</version>
 </dependency>

 <dependency>
 <groupId>org.json</groupId>
 <artifactId>json</artifactId>
 <version>20160212</version>
 </dependency>

 <dependency>
 <groupId>io.jsonwebtoken</groupId>
 <artifactId>jjwt</artifactId>
 <version>0.6.0</version>
 </dependency>

   <dependency>
 <groupId>log4j</groupId>
 <artifactId>log4j</artifactId>
 <version>1.2.17</version>
 </dependency>




 <dependency>
 <groupId>commons-io</groupId>
 <artifactId>commons-io</artifactId>
 <version>2.4</version>
 </dependency>

 <dependency>
 <groupId>org.apache.commons</groupId>
 <artifactId>commons-lang3</artifactId>
 <version>3.4</version>
 </dependency>

 <dependency>
 <groupId>org.apache.commons</groupId>
 <artifactId>commons-email</artifactId>
 <version>1.4</version>
 </dependency>

      <!-- JSON -->
 <dependency>
 <groupId>com.fasterxml.jackson.core</groupId>
 <artifactId>jackson-core</artifactId>
 <version>2.7.4</version>
 </dependency>


    <dependency>
 <groupId>com.fasterxml.jackson.core</groupId>
 <artifactId>jackson-databind</artifactId>
 <version>2.7.4</version>
 </dependency>


 <dependency>
 <groupId>com.fasterxml.jackson.core</groupId>
 <artifactId>jackson-annotations</artifactId>
 <version>2.7.4</version>
 </dependency>


   <dependency>
 <groupId>com.fasterxml.jackson.datatype</groupId>
 <artifactId>jackson-datatype-hibernate5</artifactId>
 <version>2.7.4</version>
 </dependency>


 <dependency>
 <groupId>com.fasterxml.jackson.datatype</groupId>
 <artifactId>jackson-datatype-jdk8</artifactId>
 <version>2.7.4</version>
 </dependency>

 <dependency>
 <groupId>org.modelmapper</groupId>
 <artifactId>modelmapper</artifactId>
 <version>0.7.5</version>
 </dependency>



<!--  
 <dependency>
 <groupId>com.fasterxml.jackson</groupId>
 <artifactId>jackson-datatype-json-org</artifactId>
 <version>1.8.0</version>
 </dependency>

 <dependency>
 <groupId>org.codehaus.jackson</groupId>
 <artifactId>jackson-mapper-asl</artifactId>
 <version>1.9.13</version>
 </dependency>-->

    <!-- SMS and voice calls 
    <dependency>
    <groupId>com.twilio.sdk</groupId>
    <artifactId>twilio-java-sdk</artifactId>
    <version>3.4.5</version>
 </dependency>-->

    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
 </dependency>

  <!-- https://mvnrepository.com/artifact/joda-time/joda-time -->
 <dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.9.4</version>
 </dependency>

   <!-- aws IoT -->
  <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-iot-device-sdk-java</artifactId>
    <version>1.0.1</version>
  </dependency>

  <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-iot-device-sdk-java-samples</artifactId>
    <version>1.0.1</version>
  </dependency>


 <!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-dynamodb -->
 <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk-dynamodb</artifactId>
    <version>1.11.33</version>
 </dependency>

 <dependency>
  <groupId>com.github.derjust</groupId>
  <artifactId>spring-data-dynamodb</artifactId>
  <version>4.3.1</version>
 </dependency>


  <!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support -->
 <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context-support</artifactId>
 </dependency>

  <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
 <dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.5.2</version>
 </dependency>

 <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
 </dependency>


  <!-- Querydsl -->


      <dependency>
          <groupId>com.mysema.querydsl</groupId>
          <artifactId>querydsl-apt</artifactId>
          <version>${querydsl.version}</version>

      </dependency>
      <dependency>
          <groupId>com.mysema.querydsl</groupId>

          <artifactId>querydsl-jpa</artifactId>
          <version>${querydsl.version}</version>
      </dependency>

  <!-- persistence -->

      <dependency>
          <groupId>org.springframework.data</groupId>
          <artifactId>spring-data-jpa</artifactId>
          <version>1.9.0.RELEASE</version>
      </dependency>

      <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-entitymanager</artifactId>
          <version>5.1.0.Final</version>
      </dependency>
 <!-- 
 <dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>2.3.1</version>
 </dependency>

  <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>bootstrap</artifactId>
        <version>3.3.5</version>
    </dependency>
       <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.2.2</version>
    </dependency>
 -->
           <!-- -AWS 
 <dependency>
 <groupId>com.amazonaws</groupId>
 <artifactId>aws-java-sdk-iot</artifactId>
 <version>1.10.62</version>
 </dependency>

 <dependency>
 <groupId>com.amazonaws</groupId>
 <artifactId>aws-java-sdk-core</artifactId>
 <version>1.10.64</version>
 </dependency>


 <dependency>
 <groupId>com.amazonaws</groupId>
 <artifactId>aws-java-sdk-machinelearning</artifactId>
 <version>1.10.64</version>
 </dependency>-->

 <!-- reporting 
 <dependency>
  <groupId>ar.com.fdvs</groupId>
  <artifactId>DynamicJasper</artifactId>
  <version>5.0.7</version>
 </dependency>-->
    </dependencies>

more .....

<plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <warSourceDirectory>src/main/webapp</warSourceDirectory>
                        <warName>webmanager</warName>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>
               <plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-compiler-plugin</artifactId>
 <configuration>
 <source>1.8</source>
 <target>1.8</target>
 </configuration>
 </plugin>

 <plugin>
  <groupId>com.mysema.maven</groupId>
  <artifactId>apt-maven-plugin</artifactId>

  <version>1.0.5</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.mysema.querydsl</groupId>
      <artifactId>querydsl-apt</artifactId>

      <version>${querydsl.version}</version>

    </dependency>
    <dependency>
      <groupId>com.mysema.querydsl</groupId>

      <artifactId>querydsl-jpa</artifactId>
      <classifier>apt</classifier>
      <version>${querydsl.version}</version>
    </dependency>
  </dependencies>
 </plugin>
 <plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>build-helper-maven-plugin</artifactId>
  <executions>
    <execution>
      <id>add-source</id>
      <phase>generate-sources</phase>
      <goals>
        <goal>add-source</goal>
      </goals>
      <configuration>
        <sources>
          <source>${project.build.directory}/generated-sources/java/</source>
        </sources>
      </configuration>
    </execution>
  </executions>
 </plugin>
    </plugins>
Community
  • 1
  • 1
bschupbach
  • 103
  • 1
  • 1
  • 9

2 Answers2

1

QueryDsl is generating into the folder target/generated-sources/java but you added target/generated-sources as source folder.

<outputDirectory>target/generated-sources/java</outputDirectory>

vs

<classpathentry kind="src" path="target/generated-sources"/>
laszlot
  • 91
  • 3
0

Try setting this to your eclipse.ini file and restarting eclipse to make sure that it's also using your JDK:

-vm
C:\jdk1.7\bin\javaw.exe

Cautions: this must go just above -vmargs you're full path to your VM maybe different than the one above

OR

Go into run configuration and set VM argument

-vm {path to jdk javaw.exe}

enter image description here

Nilesh
  • 237
  • 1
  • 3
  • 13