案例


今天搭建spring boot 环境时,使用mvn install ,出现Failed to execute goal org.springframework.boot:spring-boot-maven-plugin异常,经过多次构建都无效,配置和异常信息如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.evanshare</groupId>
<artifactId>springBootDemo</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<!-- Inherit defaults from Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
</parent> <!-- Add typical dependencies for a web application -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies> <!-- Package as an executable jar -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build> </project>

异常信息:

"D:\Program Files\Java\jdk1.8.0_66\bin\java" -Dmaven.multiModuleProjectDirectory=D:\Repository\Git\Eshare_practices\SpringBootDemo -DarchetypeCatalog=internal -Dmaven.home=D:\Maven\apache-maven-3.3.3-bin\apache-maven-3.3.3 -Dclassworlds.conf=D:\Maven\apache-maven-3.3.3-bin\apache-maven-3.3.3\bin\m2.conf -Didea.launcher.port=7535 "-Didea.launcher.bin.path=D:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.1.3\bin" -Dfile.encoding=UTF-8 -classpath "D:\Maven\apache-maven-3.3.3-bin\apache-maven-3.3.3\boot\plexus-classworlds-2.5.2.jar;D:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.1.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=2016.1.3 -s D:\Maven\apache-maven-3.3.3-bin\apache-maven-3.3.3\conf\settings.xml -Dmaven.repo.local=D:\Users\10856214\.m2\repository install
[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Unrecognised tag: 'repository' (position: START_TAG seen ...<profile>\n\t<repository>... @281:14) @ D:\Maven\apache-maven-3.3.3-bin\apache-maven-3.3.3\conf\settings.xml, line 281, column 14
[WARNING] Unrecognised tag: 'repository' (position: START_TAG seen ...<profile>\n\t<repository>... @281:14) @ D:\Maven\apache-maven-3.3.3-bin\apache-maven-3.3.3\conf\settings.xml, line 281, column 14
[WARNING]
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building springBootDemo 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ springBootDemo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ springBootDemo ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ springBootDemo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Repository\Git\Eshare_practices\SpringBootDemo\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ springBootDemo ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ springBootDemo ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-war) @ springBootDemo ---
[INFO] Packaging webapp
[INFO] Assembling webapp [springBootDemo] in [D:\Repository\Git\Eshare_practices\SpringBootDemo\target\springBootDemo-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Repository\Git\Eshare_practices\SpringBootDemo\src\main\webapp]
[INFO] Webapp assembled in [133 msecs]
[INFO] Building war: D:\Repository\Git\Eshare_practices\SpringBootDemo\target\springBootDemo-1.0-SNAPSHOT.war
[INFO]
[INFO] --- spring-boot-maven-plugin:1.4.0.RELEASE:repackage (default) @ springBootDemo ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.576 s
[INFO] Finished at: 2016-09-10T23:08:14+08:00
[INFO] Final Memory: 20M/315M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage (default) on project springBootDemo: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage failed: Unable to find main class -> [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/PluginExecutionException Process finished with exit code 1


解决方案

注意这句异常信息:
Unable to find main class -> [Help 1]
经过排查,原来是因为我在idea构建maven web项目时,没有加入java文件夹和spring boot的入口配置类

1.在main目录下创建一个java目录,然后创建一个入口类


2.点击Mvn clean 和Mvn install,此时可以在控制台看到构建成功的信息


Springboot | Failed to execute goal org.springframework.boot:spring-boot-maven-plugin的更多相关文章

  1. 关于Springboot打包错误的问题 | Failed to execute goal org.springframework.boot:spring-boot-maven-plugin

    最近在使用spring-boot整合多模块,但是在父pom中打包maven install时总会报错:Failed to execute goal org.springframework.boot:s ...

  2. springboot错误1 Failed to execute goal org.springframework.boot:spring-boot-maven-plugin

    关于Springboot打包错误的问题 | Failed to execute goal org.springframework.boot:spring-boot-maven-plugin https ...

  3. Failed to execute goal org.springframework.boot

    报错 [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:ru ...

  4. 【spring cloud】在spring cloud服务中,打包ms-core失败,报错Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.4.RELEASE:repackage (default) on project

    在spring cloud服务中,有一个ms-code项目,只为所有的微服务提供核心依赖和工具类,没有业务意义,作为核心依赖使用.所以没有main方法,没有启动类. 在spring cloud整体打包 ...

  5. Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.3.RELEASE:repackage (repackage)

    解决方案是删除 pom.xml配置的问题 <build> <plugins> <plugin> <groupId>org.springframework ...

  6. maven打包 invalid entry size Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.14.RELEASE:repackage (default) on project

    打包失败,但是不知是具体是什么引起得,使用mvn -e clean package,定位到报错得代码 在定位到代码,打上断点,使用maven 打包debug模式 找到dubbo.properties, ...

  7. SpringBoot_Exception_02_Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.6.RELEASE:run

    一.现象 上一个异常解决之后,出现了这个异常: [WARNING] The requested profile "pom.xml" could not be activated b ...

  8. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war

    创建springboot项目,且不采用<parent>引入springboot时,pom.xml如下: <?xml version="1.0" encoding= ...

  9. Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project sharp-common: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin

    [INFO] Scanning for projects... [INFO] [INFO] -----------------------< com.sharp:sharp-common > ...

随机推荐

  1. 曹工杂谈--使用mybatis的同学,进来看看怎么在日志打印完整sql吧,在数据库可执行那种

    前言 今天新年第一天,给大家拜个年,祝大家新的一年里,技术突突突,头发长长长! 咱们搞技术的,比较直接,那就开始吧.我给大家看看我demo工程的效果(代码下边会给大家的): 技术栈是mybatis/m ...

  2. 洛谷P1638 逛画展 题解 尺取法/双指针/队列

    题目链接:https://www.luogu.com.cn/problem/P1638 题目大意: 给你一个长度为 \(n (\le 10^6)\) 的数组,数组中每个元素的范围在 \(1\) 至 \ ...

  3. SpringBoot集成Mybatis动态多数据源后,MybatisPlus的IPage失效的问题解决方案

    背景 之前做数据抽取的时候,搭了一个mybatis动态数据源切换的架子.方便他们写抽取的代码.今天同事问我,架子里面的mybatisplus的IPage失效了是什么问题.想了一下,应该是写动态数据源的 ...

  4. linux下安装mysql5.7.25详细教程

    前言 最近项目上线,开始给用户测试了.搞下来好多台服务器,自然要装一个mysql的服务器.想想广大博友应该都会遇到如何装mysql的问题,就此分享,给大家一个安装指南.供大家以后安装的时候,提高效率, ...

  5. cc协议(知识共享,Creative Commons),程序员的基础守则之一

    知识共享 我在浏览git开源代码的时候,浏览到一句话: 版权声明:本文为CSDN博主「...」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明. 原文链接:http ...

  6. Java带有运算符的字符串转换为Long型

    由于项目需要在配置文件中配置一个刷新时间,但是配置文件中取出来来的数据肯定是字符串,然后要将该带有运算符的字符串转换为Long型.具体代码如下: 配置文件system.properties中: ref ...

  7. 转载 css截取td里面的内容 如何固定td th的宽度

    源博客地址:http://blog.csdn.net/u011456552/article/details/53839255 效果图: 源码: <!DOCTYPE html> <ht ...

  8. ArcEngine语法笔记(VB)

    1.获取图层字段 Dim pTable As ITable = pLayer Dim pField As IField pField = pTable.Fields.Field(i) Next  2. ...

  9. windows创建git并连结github

    1.下载跟自己系统相对应的git版本 2.默认安装 3.绑定用户 git config --global user.name ""git config --global user. ...

  10. ntelliJ IDEA添加注释常用的快捷键

    IDEA可以使用快捷键添加行注释Ctrl+/.块注释Ctrl+Shift+/,还可以快速生成类注释.方法注释等,下面就介绍这几种快捷键的用法