這是第一篇博客,很早想寫了,只不過每次解決問題後都覺得人家寫的蠻好的,自己無須再寫了,不過昨天打包時遇到的這個問題,自己找半天解決了,看很多博客也是許久才解決,不說了我的方法如下:
首先如果直接打包會出現各種找不到class的問題:
然後按照其他博客的方法:
並在pom.xml里加入
<build> <resources> <resource> <directory>src/main/libs</directory> <targetPath>BOOT-INF/lib/</targetPath> <includes> <include>**/*.jar</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <targetPath>BOOT-INF/classes/</targetPath> </resource> </resources> </build>但是...我做到這裏時clean包確實成功了,但是install時還是會報如下錯誤:
Description:
Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
java.lang.IllegalStateException: Failed to load ApplicationContext
Failed to determine a suitable driver class
琢磨半天意思就是我的數據庫鏈接對象不能實例化,說明我的配置文件根本沒有加載進來,然後試着引入一下配置文件
然後就成功了...雖然暫時解決了,但是相信以後問題還會有很多很多,寫下這一篇博客,是想和我遇到同樣問題的大佬們能快速解決,處女之作多多關照~~~