今天運行項目時出錯,原因是原項目在jdk1.8下運行的,升級成jdk11之后缺了一些jar包。
溫馨提示:大家在做項目時一定要注意版本問題。
解決方案一:
降低JDK 版本到 JDK 8
解決方案二:
在pom.xml文件中添加如下依賴:
<dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-core</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> <version>1.1.1</version> </dependency>
至此,問題完美解決,項目成功運行!
打包resource
<resources>
<resource>
<!--需要打包的目錄-->
<directory>src/main/java</directory>
<!--目錄中的文件類型-->
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
