【问题标题】:Why I am getting an unknown error in pom.xml file when I add the spring-boot-starter-security dependency?为什么我在添加 spring-boot-starter-security 依赖项时在 pom.xml 文件中出现未知错误?
【发布时间】:2020-02-01 18:44:28
【问题描述】:

spring-boot-starter-security 依赖项 添加到 pom.xml 文件后出现未知错误。我也尝试在 Eclipse 中使用 maven--->update project 选项,但出现错误仍然存在。我 100 % 确定该错误与上述依赖项有关,因为当我删除它时,问题就解决了。

pom.xml 文件

<?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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.4.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.hasiya.springboot.demo</groupId>
    <artifactId>firstSpringBootApp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>firstSpringBootApp</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>




    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

【问题讨论】:

  • 完全相同的 pom 对我有用。你可以创建一个示例项目并在 github 中发布以重现错误吗?
  • 如果您尝试从命令行调用 mvn clean package 会发生什么?
  • @Daniele 当我使用 eclipse 运行 mvn clean 时没有任何反应
  • 不仅仅是clean,还有clean package
  • 没有命令行输出,很难帮你。

标签: java xml spring-boot maven


【解决方案1】:

你可以更新 Maven 项目来解决这个问题。

【讨论】:

  • 了解更多有关如何开始更新的详细信息以及为屏幕截图提供上下文会很有帮助。
【解决方案2】:

这对我有用: https://github.com/sarl/sarl/issues/921 这基本上是将其添加到您的 pom.xml 文件中:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>

【讨论】:

    猜你喜欢
    • 2015-12-28
    • 2021-08-22
    • 1970-01-01
    • 2017-03-19
    • 2017-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-01
    相关资源
    最近更新 更多