视频的starter-canal根本没有,视频上说这个依赖在阿里云的中央的仓库也找不到,导致搭建微服务很可能卡下来,也就不能实现对mysql的数据监控。mysql-slave
于是网上找到了 github的资源,下载地址
https://github.com/chenqian56131/spring-boot-starter-canal
安装到maven仓库实现数据监控
3 在target中找到打包好的jar文件
4 将jar包install到maven仓库中
mvn install:install-file “-DgroupId=com.xpand” “-DartifactId=starter-canal” “-Dversion=0.0.1-SNAPSHOT” “-Dpackaging=jar” “-Dfile=starter-canal-0.0.1-SNAPSHOT.jar”
5 安装完毕,此时在maven仓库里面可以看到已经安装好的jar包
期间遇到的问题:
开始我用的jdk默认版本是1.7 报错
2 maven程序默认路径错误
mvn install的命令都没法用
mvn install:install-file -DgroupId=com.xpand -DartifactId=starter-canal -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar -Dfile=abc.jar
在win 7 里面运行此命令构建无问题,但在win 10里面构建碰见如下错误,看上去像是找不到啥pom
PS D:\MAVEN\mavenmvn install:install-file -DgroupId=com.xpand -DartifactId=starter-canal -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar -Dfile=abc.jar
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.166 s
[INFO] Finished at: 2020-03-09T21:45:56+08:00
[INFO] Final Memory: 7M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (D:\MAVEN\maven_repository\maven_repository\spring-boot-starter-canal-master(2)\spring-boot-starter-canal-master\starter-canal\target). 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]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
PS D:\MAVEN\maven_repository\maven_repository\spring-boot-starter-canal-master(2)\spring-boot-starter-canal-master\starter-canal\target>
然后在网上查找解决办法后,万能的百度帮我找到需要在所有参数加上" " ,我加上就好了,原因不明,如果有大佬看见了麻烦帮解释下,小弟先谢了啊。
mvn install:install-file "-DgroupId=com.xpand" "-DartifactId=starter-canal" "-Dversion=0.0.1-SNAPSHOT" "-Dpackaging=jar" "-Dfile=abc.jar"
参考大佬的资料:
https://blog.csdn.net/sdTAyhn/article/details/104162126
https://www.cnblogs.com/zhexuejun/p/11525623.html
https://stackoverflow.com/questions/6704813/maven-generating-pom-file/11199865#11199865
————————————————————————————————————————————
后视频讲解了一个方便的办法
C:\Users\pengx\Downloads\spring-boot-starter-canal-master\spring-boot-starter-canal-master\starter-canal>mvn clean install -Deskiptest
进入到canal目录
直接在含有pom文件中的目录里面运行
mvn clean install -Deskiptest
安装即可
2020/03/21