为什么我在 pom.xml 的第 1 行收到未知错误?

2022-08-31 08:12:45

在 Eclipse IDE 中的第 1 行出现未知错误。直到昨天,它一直工作正常,但是在从master更新我的项目并在修复合并冲突后,突然之间在pom.xml中获得“未知错误”。除了我,我的队友都没有面临这个问题。我还更改了工作区,删除了缓存,但仍然没有运气。pom.xml

我正在为这个项目使用h2数据库,尽管在数据中插入值.sql,它并没有拾取任何值并插入到h2 DB表中。在出现此问题之前,它工作正常。我觉得这是由于pom.xml的问题,我不确定。请帮忙

我删除了现有项目,并从master获取了最新的代码。之后,用户(包括存储库文件夹)下已删除的 .m2 文件夹。我确实更新了项目并启用了快照/版本的强制更新,maven clean和maven build。但没有任何帮助。

啪.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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.abc.roster</groupId>
    <artifactId>spring-boot-roster-app</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>spring-boot-roster-app</name>
    <description>Demo project for Spring Boot Roster</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.0.BUILD-SNAPSHOT</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <!-- <start-class>com.infosys.roster.SpringBootRosterAppApplication</start-class> -->
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <!--encryption lib -->
        <dependency>
            <groupId>org.jasypt</groupId>
            <artifactId>jasypt</artifactId>
            <version>1.9.2</version>
        </dependency>

        <dependency>
            <groupId>org.jasypt</groupId>
            <artifactId>jasypt-springsecurity3</artifactId>
            <version>1.9.0</version>
        </dependency>

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

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

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

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>

        </dependency>


<!--        <dependency> -->
<!--         <groupId>org.hibernate</groupId> -->
<!--         <artifactId>hibernate-core</artifactId> -->
<!--         <version>5.2.10.Final</version> -->
<!--   </dependency> -->

        <!-- <dependency> -->
        <!-- <groupId>io.springfox</groupId> -->
        <!-- <artifactId>springfox-swagger2</artifactId> -->
        <!-- <version>2.7.0</version> -->
        <!-- <scope>compile</scope> -->
        <!-- </dependency> -->


        <!-- <dependency> -->
        <!-- <groupId>io.springfox</groupId> -->
        <!-- <artifactId>springfox-swagger-ui</artifactId> -->
        <!-- <version>2.7.0</version> -->
        <!-- <scope>compile</scope> -->
        <!-- </dependency> -->

        <!-- <dependency> -->
        <!-- <groupId>io.springfox</groupId> -->
        <!-- <artifactId>springfox-data-rest</artifactId> -->
        <!-- <version>2.7.0</version> -->
        <!-- </dependency> -->
    </dependencies>

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

    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
        </pluginRepository>
    </pluginRepositories>

</project> 

应用程序.属性

server.port=
spring.h2.console.path=/h2
spring.h2.console.enabled=true

spring.datasource.url=


spring.datasource.username=
spring.datasource.password=
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.platform=h2
spring.datasource.initialization-mode=always

spring.jpa.hibernate.ddl-auto=update
spring.datasource.continue-on-error=true

spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=false

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect

应该删除pom中的未知错误.xml并且我必须能够在H2 db中填充值。


答案 1

根据当前状态回答

此问题已修复:

请从 https://download.eclipse.org/m2e-wtp/releases/1.4/ 安装 mavenarchiver 插件 0.17.3 的 m2e 连接器


过时的答案

与从Spring Boot降级到的更不深刻的变化是,只要存在此错误,就会仅将受影响的Maven JAR插件从降级为:2.1.5.RELEASE2.1.4.RELEASE3.1.23.1.1

<properties>
    <!-- ... -->
    <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>

答案 2

将 3.1.1 添加到属性中,如下所示,而不是修复问题

<properties>
        <java.version>1.8</java.version>
        <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>

只需更新项目=>右键单击=> Maven=>更新项目


推荐