关于spring maven项目properties配置文件不能被编译导致的错误
一开始的错误如下:
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).
试了网上的各种方法:加上@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})这个注解,虽然可以解决,但是到后面会报错,后来我发现是我的配置文件properties配置文件没有被编译,故而没有url这些数据,需要把
其中的
<packaging>pom</packaging>
去掉,但是我去掉会报错,又改为其他的jar,war等也会报错,如下:
pom里也可以需要的文件也打包,我是使用如下代码:
但是发现依旧不能打包,请问我该怎么办才能让我的配置文件properties被打包?