You need to run build with JDK or have tools.jar on the classpath

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.1:process:default:generate-sources) 
 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 at 
 com.mysema.maven.apt.AbstractProcessorMojo.execute(AbstractProcessorMojo.java:322) at 
 org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at 
 org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331) at 
 org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362) at 
 org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at 
 org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360) at 
 org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:
 52) at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137) at 
 org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172) at 
 org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1) at 
 org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at 
 org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99) at 
 org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86) at 
 org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200) at 
 org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734) at 
 org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at 
 org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205) at 
 org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245) at 
 org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:300) at 
 org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at 
 org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303) at 
 org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:359) at 
 org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:382) at 
 org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144) at 
 org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235) at 
 org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by: 
 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 at 
 com.mysema.maven.apt.AbstractProcessorMojo.execute(AbstractProcessorMojo.java:289) ... 32 more

1.仔细的看看自己的电脑的环境变量有没有配置错误,我的电脑是这样配置的:

JAVA_HOME    :     C:\JavaJDK\jdk1.8.0_20

Path                   :    %JAVA_HOME%\jre\bin;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;

2.检查Eclipse中jre是都配置正确

3.在eclipse.ini文件新增jdk的javaw.exe配置

4.重启eclipse ok 亲测可用

 

 

你可能感兴趣的:(Maven)