1、问题:
我的项目是springboot项目
主项目下面有三个模块,如A,B,C,
模块A的pom,功能定义结果和处理异常,是公共模块
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sss</artifactId>
<groupId>com.xxx</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>A</artifactId>
模块B的pom,依赖于模块A,功能:定义swagger配置文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sss</artifactId>
<groupId>com.xxx</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>B</artifactId>
<dependencies>
<dependency>
<groupId>com.xxx</groupId>
<artifactId>A</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!--swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<!--swagger ui-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
</dependencies>
</project>
模块C是核心模块,处理业务,在C中定义一个新街口,始终swagger-ui无法显示这个新接口,
后来经过这些步骤解决了,不知道为什么?
步骤1:我在主项目中使用maven的clean,然后运行项目,发现报错“错误: 找不到或无法加载主类 com.test.serviceApplication”,通过这篇博文https://blog.csdn.net/syr1136877833/article/details/103054336
了解可能是我项目用了几个模块,IDEA无法自动编译
步骤2:删去.ide,重新导入,然后运行,发现项目可以运行了,而且swagger-ui上也显示了新定义的接口