2016-11-16 47 views
0

我无法在eclipse中生成querydsl Q类。如果任何人有任何帮助,将不胜感激。下面是从我的pom.xml文件eclipse中的Querydsl未在maven项目中生成查询类型类

我建议复制插件设置设在这里我已经试过的方法和片段:

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

M2E and having maven generated source folders as eclipse source folders

我确信,Maven的安装并更改我的eclipse .ini文件以运行JDK,如下所述:

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

我已经到项目文件夹并运行mvn generate-sources并将文件夹添加到类路径。尽管如此,该项目无法找到任何生成的Q类,并且在目标文件夹中看不到任何Q类。如果有人有任何见解,我会非常感激。由于

<?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> 

更多.....

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

回答

0

试试设置为您的eclipse.ini文件并重新启动Eclipse来确保它也使用JDK:

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

注意事项: 这必须在-vmargs 之上,你的虚拟机的完整路径可能与上面的路径不同

OR

进入运行配置,并设置VM参数

-vm {path to jdk javaw.exe} 

enter image description here

相关问题