问题遇到的现象和发生背景
springboot多模块开发的web模块无法使用batis模块,构造依赖时就报无法解析 mysql:mysql-connector-java:pom:8.0.31 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt.
用代码块功能插入代码,请勿粘贴截图
主项目pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.smile.hd</groupId>
<artifactId>batis</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.30</version>
</dependency>
</dependencies>
<modules>
<module>client</module>
<module>management</module>
<module>batis</module>
</modules>
web模块pom.xml
<dependencies>
<dependency>
<groupId>com.smile.hd</groupId>
<artifactId>batis</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
batis模块pom.xml没有自定义任何东西,数据库和mybatis-plus继承了主pom.xml的
运行结果及报错内容
无法解析 mysql:mysql-connector-java:pom:8.0.31 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact mysql:mysql-connector-java:pom:8.0.31 from/to central (https://repo.maven.apache.org/maven2): transfer failed for https://repo.maven.apache.org/maven2/mysql/mysql-connector-java/8.0.31/mysql-connector-java-8.0.31.pom
我的解答思路和尝试过的方法
目前没有思路,没有分batis模块时我在web模块里面直接写batis是没问题的,但分一个专门创batis的模块出来依赖的时候就不行了。
我想要达到的结果
我有两个模块,一个是用户端的web模块,一个是管理端的web模块,两个web模块设置了不一样的端口,这两个模块我想让他们都可以用同一个batis。