Waitme9 2022-07-09 21:46 采纳率: 79.4%
浏览 91
已结题

关于spring maven项目properties配置文件不能被编译导致的错误

关于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等也会报错,如下:

img


pom里也可以需要的文件也打包,我是使用如下代码:

img


但是发现依旧不能打包,请问我该怎么办才能让我的配置文件properties被打包?

  • 写回答

2条回答 默认 最新

  • 江湖是人情世故 2022-07-11 15:17
    关注

    mybatis的版本修改一下,版本冲突导致的。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 7月20日
  • 已采纳回答 7月12日
  • 创建了问题 7月9日

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作