注意:要定位到项目文件夹的目录下操作下面指令,不然会报没有pom文件夹的错误:
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\ ). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]

1.在项目的端口中运行以下指令
mvn org.apache.maven.plugins:maven-install-plugin:3.1.0:install-file -Dfile="C:\D\DMdb\drivers\jdbc\DmJdbcDriver18.jar" -DgroupId="com.dm" -DartifactId="DmJdbcDriver" -Dversion="1.8.0" -Dpackaging="jar" -DgeneratePom=true
-DgroupId=com.dm 和-Dversion=1.8.0 会提示
[ERROR] Unknown lifecycle phase ".8.0". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-v ersion>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compi le, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1]
报错把 ".8.0" 当成了生命周期阶段,说明 -Dversion=1.8.0 在命令行被拆成了 1 和 .8.0 两个 token(和之前 .dm 的问题是同一类原因):shell/换行/续行符/隐藏字符 导致点号开头的片段被单独传给 Maven。故加一个双引号即可
执行完后的结果:

2. 然后再到pom文件中加入依赖
<!-- 达梦数据库驱动包-->
<dependency>
<groupId>com.dm</groupId>
<artifactId>DmJdbcDriver</artifactId>
<version>1.8.0</version>
</dependency>
3.修改数据库连接的配置文件
spring:
datasource:
driver-class-name: dm.jdbc.driver.DmDriver
# 推荐用 ?schema=... 参数(注意大写或小写均可,但以你驱动文档为准)
url: jdbc:dm://localhost:5236?schema=springboot_vue&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
username: SYSDBA
password: *************
1万+

被折叠的 条评论
为什么被折叠?



