programing tip

pom.xml의 줄 1에서 알 수없는 오류가 발생하는 이유는 무엇입니까?

itbloger 2020. 12. 7. 07:55
반응형

pom.xml의 줄 1에서 알 수없는 오류가 발생하는 이유는 무엇입니까?


pom.xmlEclipse IDE의 라인 1에서 알 수없는 오류가 발생 합니다. 어제까지 잘 작동했지만 마스터에서 내 프로젝트를 업데이트하고 병합 충돌을 수정 한 후 갑자기 pom.xml에서 "알 수없는 오류"가 발생했습니다. 저를 제외하고는 팀원 중 누구도이 문제에 직면하지 않습니다. 나는 또한 작업 공간을 변경하고 캐시를 삭제했지만 여전히 운이 없습니다.

이 프로젝트에 h2 데이터베이스를 사용하고 있는데 data.sql에 값을 삽입했지만 값을 선택하지 않고 h2 DB 테이블에 삽입합니다. 이 문제 전에는 잘 작동했습니다. 나는 pom.xml의 문제로 인한 것이라고 생각하지만 확실하지 않습니다. 도와주세요

기존 프로젝트를 삭제하고 마스터에서 최신 코드를 가져 왔습니다. 그 후 저장소 폴더를 포함하여 사용자 아래의 .m2 폴더를 삭제했습니다. 나는 프로젝트를 업데이트하고 스냅 샷 / 릴리스, maven clean 및 maven 빌드의 강제 업데이트를 활성화했습니다. 그러나 아무것도 도움이되지 않습니다.

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 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> 

application.properties

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의 값을 채울 수 있어야합니다.


현재 상황에 따라 대답하다

이 문제해결되었습니다 .

https://download.eclipse.org/m2e-wtp/releases/1.4/ 에서 mavenarchiver 플러그인 0.17.3 용 m2e 커넥터를 설치 하십시오.


쓸모없는 대답

봄 부팅에서 다운 그레이드보다는 덜 심오한 변화 2.1.5.RELEASE2.1.4.RELEASE만 다운 그레이드 될 영향을받는 메이븐 JAR 플러그인 에서 3.1.23.1.1이 버그가 존재하는 긴 다음과 같음 :

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

For me I changed in the parent tag of the pom.xml and it solved it change 2.1.5 to 2.1.4 then Maven-> Update Project


As per the suggestion from @Shravani, in my pom.xml file, I changed my version number in the area from this:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.5.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

to this:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.4.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

I then right clicked on the project and did a 'Maven -> Update project...'. This made the problem go away for me.


There is a bug about Eclipse and spring-boot-starter-parent 2.1.5

"if the maven packaging attribute is war then no problem.The problem is in jar type." So you can also fix this problem by changing packaging type.

<packaging>war</packaging>

I updated spring tool suits by going help > check for update.


While I cannot reproduce your error (as none of your team mates can either), I have a suggestion, that might help you.

Have you heard of the Byte Order Mark? As it appears on line 1 it is a likely candidate for your troubles. Maybe you changed a setting somewhere that somehow leads to the error. This quote from the Wikipedia article is particularly relevant I think:

BOM use is optional. Its presence interferes with the use of UTF-8 by software that does not expect non-ASCII bytes at the start of a file but that could otherwise handle the text stream.


same problem for me, original code from spring starter demo gives unknown error on line 1:

<?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>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.6.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
...

Changing just the version of 2.1.6.RELEASE to 2.1.4.RELEASE fixes the problem.


For me I changed in the parent tag of the pom.xml and it solved it change 2.1.5 to 2.1.4 then Maven-> Update Project. its worked for me also.


Got this error on eclipse IDE version 4.10, Spring boot 2.2.0.M4, changed the Spring boot version to 2.2.0.M2 (after many other solutions recommended and it solved the error). Maybe something missing or broken in the latest version of Spring boot starter project module maven POM.


In my pom.xml file I had to downgrade the version from 2.1.6.RELEASE for spring-boot-starter-parent artifact to 2.1.4.RELEASE

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.6.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
</parent>

to be changed to

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.4.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
</parent>

And that weird Unknown error disappeared

참고URL : https://stackoverflow.com/questions/56142369/why-am-i-getting-unknown-error-in-line-1-of-pom-xml

반응형