Maven 依赖必须申明在父工程pom中,若写在子工程pom,则依赖不生效>_<,求各位好大Lao解惑!需将依赖申明在子工程中并生效明
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.10</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.smart.classroom</groupId>
<artifactId>smart-classroom-subscription</artifactId>
<version>1.0.0</version>
<name>smart-classroom-subscription</name>
<description>smart-classroom-subscription</description>
<properties>
<java.version>1.8</java.version>
</properties>
<modules>
<module>scs-utility</module>
</modules>
</project>
<?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>smart-classroom-subscription</artifactId>
<groupId>com.smart.classroom</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>scs-utility</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!-- *********************工具库 start********************* -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- *********************工具库 end********************* -->
</dependencies>
</project>
import lombok.Getter;
public enum SortDirection {
ASC("升序"),
DESC("降序");;
@Getter
private final String description;
SortDirection(String description) {
this.description = description;
}
public static String toString(SortDirection orderStatus) {
if (orderStatus == null) {
return null;
}
return orderStatus.name();
}
public static SortDirection toEnum(String s) {
if (s == null) {
return null;
}
return SortDirection.valueOf(s);
}
}
去学一下maven就知道了
http://t.csdn.cn/rMy3v
依赖的传递性
参考 https://blog.csdn.net/fxkcsdn/article/details/97620503
加入版本号如下,之后即使删除版本号也不汇报红,不知道版本号,一般输入 在这输入2或3会自动出现最新版本号,可以随意选择,如果不显示可以百度版本号,如果maven加了版本号刷新继续爆红,可能是idea没有及时更新,可以重启idea
<!-- Srping Boot 打包工具 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.9.RELEASE</version>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
<!-- 指定JDK编译版本 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>