1
votes

I want to use dom4j to parse xml string. But when I add dom4j dependency in pom file, my dev tool(Eeclipse) prompt errors below: enter image description here I tried to refresh project and maven's update project, the errors still occured. If remove the dependency, all of errors disappear, also dom4j cannot use.

  • Eclipse version:

    Eclipse Java EE IDE for Web Developers.
    Version: Photon Release (4.8.0)
    Build id: 20180619-1200

  • POM file:

    http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>
    
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
    </parent>
    
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
    
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
    
        <dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
        </dependency>
    </dependencies>
    
    <properties>
        <java.version>1.8</java.version>
    </properties>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    

  • Maven Version: enter image description here

1
Have you tried right clicking on the project and Maven -> Update Project? Every time the pom is changed, this needs to be run.karen
Yes, I have tried Maven->Update project and also refresh project, but the errors still occur.@karenTony
If you have maven installed on your computer try "mvn install" to install any missing packages (further details herekaren
First think is: Try to build your project on plain command line...khmarbaise

1 Answers

0
votes

I figured out it through a whole day working, the fix steps are: 1. the first line of errors prompt in eclipse is : fail to read artifact descriptor for xml-apis:xml-apis:jar:1.4.01.(the first capture image of the question) 2. I assumed that something are wrong with xml-apis in maven repository, so I find the directory of xml-apis in maven repository and remove them all 3. After that, I use Maven->Update project in eclipse, the errors run away.

I think the reason is: some files of xml-apis were damaged.