maven springboot project cannot find main class
为情所困
为情所困 2017-05-17 10:04:35
0
2
1233
  4.0.0 com.sohu.mrd WeChatNews 1.0-SNAPSHOT jar  org.springframework.boot spring-boot-starter-parent 1.5.2.RELEASE    org.springframework.boot spring-boot-starter-web   spring-boot-starter-logging org.springframework.boot     org.springframework.boot spring-boot-starter-log4j2   com.alibaba fastjson 1.2.7   org.jsoup jsoup 1.7.2    com.mrd.wechat.WeChatNewsApplication   WeChatNews   org.springframework.boot spring-boot-maven-plugin    repackage        src/main/resources true  application-online.properties application-preonline.properties application-test.properties application.properties    true src/main/resources  application-${profileActive}.properties application.properties     
"C:\Program Files\Java\jdk1.8.0_91\bin\java" -Dmaven.multiModuleProjectDirectory=C:\Users\shiweiwang\Desktop\WeChatNews -DarchetypeCatalog=internal "-Dmaven.home=D:\Idea2016\IntelliJ IDEA 2016.3.2\plugins\maven\lib\maven3" "-Dclassworlds.conf=D:\Idea2016\IntelliJ IDEA 2016.3.2\plugins\maven\lib\maven3\bin\m2.conf" -Didea.launcher.port=7536 "-Didea.launcher.bin.path=D:\Idea2016\IntelliJ IDEA 2016.3.2\bin" -Dfile.encoding=UTF-8 -classpath "D:\Idea2016\IntelliJ IDEA 2016.3.2\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar;D:\Idea2016\IntelliJ IDEA 2016.3.2\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=2016.3.3 install [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building WeChatNews 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ WeChatNews --- [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) @ WeChatNews --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 6 source files to C:\Users\shiweiwang\Desktop\WeChatNews\target\classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ WeChatNews --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\shiweiwang\Desktop\WeChatNews\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ WeChatNews --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ WeChatNews --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ WeChatNews --- [INFO] Building jar: C:\Users\shiweiwang\Desktop\WeChatNews\target\WeChatNews.jar [INFO] [INFO] --- spring-boot-maven-plugin:1.5.2.RELEASE:repackage (default) @ WeChatNews --- [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ WeChatNews --- [INFO] Installing C:\Users\shiweiwang\Desktop\WeChatNews\target\WeChatNews.jar to C:\Users\shiweiwang\.m2\repository\com\sohu\mrd\WeChatNews.0-SNAPSHOT\WeChatNews-1.0-SNAPSHOT.jar [INFO] Installing C:\Users\shiweiwang\Desktop\WeChatNews\pom.xml to C:\Users\shiweiwang\.m2\repository\com\sohu\mrd\WeChatNews.0-SNAPSHOT\WeChatNews-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.954 s [INFO] Finished at: 2017-05-04T14:51:00+08:00 [INFO] Final Memory: 30M/305M [INFO] ------------------------------------------------------------------------ Process finished with exit code 0

[root@ebeef2d5a5b3 WeChatNews]# nohup java -cp WeChatNews.jar com.mrd.wechat.WeChatNewsApplication &>start.log &
[1] 40713
[root@ebeef2d5a5b3 WeChatNews]# tail -f ./start.log
nohup: Ignore input
Error: Main class com.mrd.wechat.WeChatNewsApplication

cannot be found or cannot be loaded
为情所困
为情所困

reply all (2)
大家讲道理

The springboot project doesn’t need to be usedmaven-shade-plugin打jar包啊, 就用spring-boot-maven-pluginIt’s fine

    習慣沉默

    Use themvn packagecommand to package the document

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!