简体   繁体   English

Spring Roo项目。 项目构建错误:无法执行目标

[英]Spring Roo project. Project build error: Failed to execute goal

I create a project based on the code from the site 我根据站点中的代码创建一个项目

roo> project setup --topLevelPackage com.foo
roo> jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
roo> entity jpa --class ~.domain.Timer
roo> field string --fieldName message --notNull
roo> repository jpa --all
roo> service --all
roo> web mvc setup
roo> web mvc view setup --type THYMELEAF
roo> web mvc controller --all --responseType THYMELEAF
roo> web mvc controller --all --pathPrefix /api
roo> quit
mvn spring-boot:run

The building of the project is completed with the following error 该项目的建设已完成,出现以下错误

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.054 s
[INFO] Finished at: 2018-09-20T19:45:28+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.mysema.maven:apt-maven-plugin:1.1.3:process
default) on project hello: You need to run build with JDK or have tools.jar on
he classpath.If this occures during eclipse build make sure you run eclipse und
r JDK as well -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swi
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]

POM.xml can be found here . 可以在此处找到POM.xml。 Spring roo-2.0.0.RELEASE The error is also displayed in the pom.xml file (the line 592): Spring roo-2.0.0.RELEASE该错误也显示在pom.xml文件中(第592行):

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)

In elcipse configuration - c:\\Program Files\\Java\\jdk1.8.0_181. 在Elcipse配置中-c:\\ Program Files \\ Java \\ jdk1.8.0_181。 When I run the project from the command line mvn spring-boot:run , I get the same result 当我从命令行mvn spring-boot:run ,得到相同的结果

First: 第一:

It's unfortunately an Eclipse issue - because you're pointing Eclipse to the JDK - which is good, but Eclipse itself is a Java app that also runs in a JVM. 不幸的是,这是一个Eclipse问题-因为您将Eclipse指向JDK-很好,但是Eclipse本身也是一个Java应用程序,它也可以在JVM中运行。 And it's running in the JRE instead of the JDK. 它在JRE中而不是JDK中运行。 The way to fix that is - in your eclipse.ini (or STS.ini - if you're using Eclipse STS) - you add this first line: 解决该问题的方法是-在eclipse.ini (或STS.ini如果使用的是Eclipse STS)中,请添加以下第一行:

-vm 
C:\Java\jdk1.8.0_181\bin\javaw.exe
  • make sure you put the right path and then put these lines just above -vmargs according to Wiki 确保您输入正确的路径,然后根据Wiki将这些行放在-vmargs上方

Second: 第二:

Also make sure you are having the jre as: 还要确保您具有以下jre:

在此处输入图片说明

如果已经有了JDK,则必须安装JDK,然后在window> preferences> java> Installed JREs上检查elcipse配置,并指向JDK路径,例如C:\\ Program Files \\ Java \\ jdk1.8.0_112

in the file Sts.ini you need to add to the beginning 在文件Sts.ini中,您需要添加到开头

-vm
c:/Program Files/Java/jdk1.8.0_181/bin/javaw.exe

In the file pom.xml replace <aspectj.plugin.version>1.8</aspectj.plugin.version> on <aspectj.plugin.version>1.9</aspectj.plugin.version> 在文件pom.xml中,将<aspectj.plugin.version>1.8</aspectj.plugin.version>上的<aspectj.plugin.version>1.9</aspectj.plugin.version>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM