提示Unable to find a single main class from the following candidates错误的原因是会从所有代码里面扫描包括main方法的类,找到多个类就报错了. 解决办法是在pom.xml指定启动的类: <properties> <start-class>com.corp.MyApplication</start-class> <project.build.sourceEncoding>UTF-8</pro…
问题如下: [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:repackage (default) on project information: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:repackage faile…
在启动SpringBoot项目是报错 Unable to find a single main class from the following candidates [boot.myboot.SampleController, boot.myboot.App] 意思 是从这两个类中找不到要执行那个main方法 执行spring-boot:run -X打印出Debug日志 [ERROR] Failed to execute goal org.springframework.boot:spring…
由于基础框架是用的网上down的源码,我将项目名字改了,估计没有进行maven clean,本地调试的时候没有问题. 当发布时候,执行maven install 一直提示上述错误. 解决办法:1.maven clean.2.mave install 解决…
关于start-class,spring boot官方手册是这么说明的: The plugin rewrites your manifest, and in particular it manages the Main-Class and Start-Class entries, so if the defaults don't work you have to configure those there (not in the jar plugin). The Main-Class in th…
SpringBoot 项目打包后获取不到resource下资源的解决 在项目中有几个文件需要下载,然后不想暴露真实路径,又没有CDN,便决定使用接口的方式来获取文件.最初的时候使用了传统的方法来获取文件路径,发现不行.查找资料后发现是SpringBoot框架导致的,得用另外的方法: //听说在linux系统中会失效. //不用听说了,就是会挂,血的教训 String path = ResourceUtils.getURL("classpath:").getPath(); //此方法返回…
在springboot项目打包成jar包时,在cmd中使用java -jar **.jar时,浏览器无法访问. 解决方法:把项目改成war包项目,在pom文件中更改,并打成war包. 使用maven命令操作: cmd进入springboot的根目录,运行 mvn clean package…
今天把本地的一个SpringBoot项目打包扔到Linux服务器上,启动执行,接口一访问就报错,但是在本地Eclipse中启动执行不报错,错误如下: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 很明显意思是xml映射文件找不到了,于是我就打开我打包的jar包,找了一下,果然没把xml文件打包进去. 但是之前的项目为啥没问题呢,原因在于我之前都是把xml文件放在src/main/re…
将springboot项目打包成jar后,上传至服务器,每次都需要手敲命令,重新部署项目,可将这些命令写入脚本中,直接运行. 启动脚本(start.sh): CUR_PATH=$(cd "$(dirname "$0")"; pwd) echo "Current path: ${CUR_PATH}" /usr/lib/java-1.8.0/jdk1.8.0_161/bin/java -jar ${CUR_PATH}/***.jar 代码中的标红部分…
``` 用gradle把springboot项目打包成jar ```### build.gradle 中添加 buildscript { repositories { mavenLocal() maven { url "http://*.*.*.*:*/nexus/content/groups/public/" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.…