为什么将依赖项添加到 pom 文件时出现错误?

时间:2021-05-12 05:12:34

标签: java spring maven

在此我使用的是 java spring 项目。 我是 java spring 的新手,所以也许我的问题很愚蠢。 我正在向项目中的 pom.xml 文件添加依赖项,但在添加的依赖项上出错。

这是pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 ">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.MichaelTutorial</groupId>
    <artifactId>conference-demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>conference-demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>


        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>


        <dependency>
            <groupId>org.projectlombok</groupId>c
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

这里是我添加的依赖项:

    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <scope>runtime</scope>
    </dependency>

在这个 org.postgresql 和 postgresql 上我得到同样的错误:

Dependency 'org.postgresql:postgresql:42.2.19' not found

知道如何修复它吗?为什么找不到版本?

0 个答案:

没有答案