Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring boot maven插件即使在I';我提到了mainClass属性及其';就在它下面';鼻子_Java_Spring_Spring Boot_Maven - Fatal编程技术网

Java Spring boot maven插件即使在I';我提到了mainClass属性及其';就在它下面';鼻子

Java Spring boot maven插件即使在I';我提到了mainClass属性及其';就在它下面';鼻子,java,spring,spring-boot,maven,Java,Spring,Spring Boot,Maven,我有一个父项目“giftcard服务”,我只用于构建它。所有代码都在名为“giftcard service main”的模块中。我能够构建(clean install)giftcard服务,但无法部署/运行它,这是通过mvn-spring-boot:run命令完成的 由于这是一个企业/公司项目,我会出于明显的原因限制一些信息 这是我在控制台上看到的错误 [INFO] Scanning for projects... [INFO] ---------------------------------

我有一个父项目“giftcard服务”,我只用于构建它。所有代码都在名为“giftcard service main”的模块中。我能够构建(
clean install
)giftcard服务,但无法部署/运行它,这是通过
mvn-spring-boot:run
命令完成的

由于这是一个企业/公司项目,我会出于明显的原因限制一些信息

这是我在控制台上看到的错误

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] giftcard-service                                                   [pom]
[INFO] giftcard-service - Main                                            [jar]
[INFO] 
[INFO] -------------< com.tc.pt:giftcard-service >-------------
[INFO] Building giftcard-service 1.0.0.1                                  [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] >>> spring-boot-maven-plugin:2.1.3.RELEASE:run (default-cli) > test-compile @ giftcard-service >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce) @ giftcard-service ---
[INFO] 
[INFO] --- git-commit-id-plugin:2.1.12:revision (default) @ giftcard-service ---
[info] isPomProject is true and skipPoms is true, return
[INFO] 
[INFO] <<< spring-boot-maven-plugin:2.1.3.RELEASE:run (default-cli) < test-compile @ giftcard-service <<<
[INFO] 
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.1.3.RELEASE:run (default-cli) @ giftcard-service ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for giftcard-service 1.0.0.1:
[INFO] 
[INFO] giftcard-service ................................... FAILURE [  2.137 s]
[INFO] giftcard-service - Main ............................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.323 s
[INFO] Finished at: 2020-03-19T18:53:35-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.3.RELEASE:run (default-cli) on project giftcard-service: Unable to find a suitable main class, please add a 'mainClass' property -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO]正在扫描项目。。。
[信息]------------------------------------------------------------------------
[信息]反应堆建造顺序:
[信息]
[信息]礼品卡服务[pom]
[信息]礼品卡服务-主[jar]
[信息]
[信息]-------------------
[信息]楼宇礼品卡服务1.0.0.1[1/2]
[信息]--------------------------------------[pom]---------------------------------
[信息]
[信息]>>>spring boot maven插件:2.1.3.版本:运行(默认cli)>测试编译@giftcard服务>>>
[信息]
[信息]---maven enforcer插件:1.4.1:enforce(enforce)@giftcard服务---
[信息]
[信息]---git提交id插件:2.1.12:修订版(默认)@giftcard服务---
[info]isPomProject为true,skipPoms为true,返回
[信息]

[INFO]在Maven输出的开始处,我看到这一行:

[INFO] Building giftcard-service 1.0.0.1

我不确定,但怀疑这意味着当您试图执行
mvn spring boot:run
时,您在父项目的目录中。我认为您需要在子项目中,主类实际上属于该子项目。

请显示完整的pom文件…这看起来很奇怪
[INFO]>>
[INFO] Building giftcard-service 1.0.0.1