如何解决包 javax.xml.bind.annotation 不存在
我尝试使用命令 mvn clean install 通过 commandpromt 构建一个 springboot 应用程序,但它给出了以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project infytel_demo7_a: Compilation failure: Compilation failure:
[ERROR] /C:/Users/shilpa.nair01/Desktop/spring boot lex/Spring REST demos with script/infytel_demo7_validation/infytel_demo7a/src/main/java/com/infytel/dto/PlanDTO.java:[3,33] package javax.xml.bind.annotation does not exist
[ERROR] /C:/Users/shilpa.nair01/Desktop/spring boot lex/Spring REST demos with script/infytel_demo7_validation/infytel_demo7a/src/main/java/com/infytel/dto/PlanDTO.java:[5,2] cannot find symbol
[ERROR] symbol: class XmlRootElement
[ERROR] /C:/Users/shilpa.nair01/Desktop/spring boot lex/Spring REST demos with script/infytel_demo7_validation/infytel_demo7a/src/main/java/com/infytel/dto/EntityList.java:[6,33] package javax.xml.bind.annotation does not exist
[ERROR] /C:/Users/shilpa.nair01/Desktop/spring boot lex/Spring REST demos with script/infytel_demo7_validation/infytel_demo7a/src/main/java/com/infytel/dto/EntityList.java:[7,33] package javax.xml.bind.annotation does not exist
[ERROR] /C:/Users/shilpa.nair01/Desktop/spring boot lex/Spring REST demos with script/infytel_demo7_validation/infytel_demo7a/src/main/java/com/infytel/dto/EntityList.java:[8,33] package javax.xml.bind.annotation does not exist
[ERROR] /C:/Users/shilpa.nair01/Desktop/spring boot lex/Spring REST demos with script/infytel_demo7_validation/infytel_demo7a/src/main/java/com/infytel/dto/EntityList.java:[10,2] cannot find symbol
[ERROR] symbol: class XmlRootElement
[ERROR] /C:/Users/shilpa.nair01/Desktop/spring boot lex/Spring REST demos with script/infytel_demo7_validation/infytel_demo7a/src/main/java/com/infytel/dto/EntityList.java:[11,2] cannot find symbol
我正在使用 java 8 和 spring boot 2.2.1.Release .PFB 映像。
PFB pom 文件:
<?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.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.infytel</groupId>
<artifactId>infytel_demo7_a</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>infytel_demo7_a</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-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Stuff related to XML serialization and deserialization -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<!-- Stuff related to XML serialization and deserialization -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<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>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
我做了以下几件事: --> 试图从 .m2 文件夹中删除存储库。 -->在pom中添加了maven编译器插件。
我在 jaxb-api 文件夹中有这么多东西:
你能帮我解决这个问题吗。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。