【问题标题】:A required class was missing while executing org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile: org/apache/maven/shared/utils/StringUtils执行 org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile:org/apache/maven/shared/utils/StringUtils 时缺少必需的类
【发布时间】:2019-02-18 04:05:12
【问题描述】:

我是初学者..我正在尝试在 spring 工具套件中使用 spring boot wit rest 服务..我已经从网站上复制了项目...我无法清除错误..我发布为图像..谢谢提前 这是我的 pom.xml...

<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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com</groupId>
    <artifactId>javainterviewpoint</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>


    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.1.RELEASE</version>
    </parent>

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

    <repositories>
        <repository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <name>javainterviewpoint</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>


</project>

【问题讨论】:

  • 请显示完整的日志输出...
  • .. 请将其发布为文本而不是图像

标签: rest maven spring-boot spring-tool-suite


【解决方案1】:

这里有几个想法:

(1) 如果您正在运行来自https://spring.io/tools 的最新版本的 Spring Tool Suite (3.9.x),则无需从网站复制项目即可开始使用。您只需转到名为“Import Spring Getting Started Content”的向导并选择,例如,“Rest Service”指南。它会将准备使用的项目导入您的工作区。

(2) 我不知道您的构建出了什么问题,但看起来您正在从 STS 中运行 Maven 命令行构建。你不需要这样做。 STS 将 Maven 集成到您的 IDE 中,为您完成所有工作。无需从命令行或上下文菜单运行 Maven 构建。只需打开启动仪表板,选择您的项目,然后按“运行”。

(3) 如果您真的想从命令行运行 Maven 构建,您肯定可以这样做。您发布的图片并没有真正揭示出了什么问题,但是从您的标题(它提到了一些关于缺少的类)我隐约猜测它可能与损坏或损坏的本地 Maven 缓存有关。因此,删除您的本地 maven 存储库(通常位于 ~/.m2/repository)并再次运行您的构建。这将再次下载所有必要的依赖项。

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 2023-03-16
    • 2015-10-20
    • 2018-11-13
    • 1970-01-01
    • 2020-01-21
    • 1970-01-01
    • 1970-01-01
    • 2022-08-10
    • 1970-01-01
    相关资源
    最近更新 更多