【发布时间】:2017-06-02 07:00:31
【问题描述】:
我也有类似this 的问题,我尝试了这两种解决方案,但没有一个适合我。
我从 github 页面复制了 querydsl 的配置。
所以我的querydsl maven依赖:
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>4.1.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
还有我的 apt 配置:
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>4.1.4</version>
</dependency>
</dependencies>
</plugin>
我还修改了eclipse.ini,在第一行添加如下:
-vm
D:\Program Files\Java\jdk1.8.0_91\bin\javaw.exe
但我直到在 eclipse 中得到同样的错误:
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.1.3:process:default:generate-sources)
当我在 cmd 中运行 mvn genarate-sources 时,出现同样的错误:
[INFO] --- apt-maven-plugin:1.1.3:process (default)
[ERROR] execute error
org.apache.maven.plugin.MojoExecutionException: 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
谁能帮帮我?
【问题讨论】:
-
执行 mvn clean install 后,我将 tools.jar 从
C:\Program Files\Java\jdk1.8.0_151\lib复制到C:\Program Files\Java\jre1.8.0_151\lib
标签: java eclipse maven querydsl