Maven多模块报错-If-you-want-an-embedded-database-H2-HSQL-or-Derby

43次阅读

共计 756 个字符,预计需要花费 2 分钟才能阅读完成。

情景

一个 Maven 单模块项目改造为多模块项目后,发现报错:

***************************
APPLICATION FAILED TO START  
***************************
​  
Description:  
​  
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be 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).  
​  
​  
Process finished with exit code 1

一种可行的解决方案

如果是 Maven 多模块项目,查看 IDEA 右上角 Edit Configurations -> Use classpath of module,此栏应为 包含程序入口的xxxApplication.javaapplication.yml的 module:

如上图,博主的程序入口 xxxApplication.javaapplication.yml放置于 server 这个 module,brother-takeaway-order是之前单体模块的名称。把此处的 module 切换为server,即可解决报错。

正文完
 0