现象:

使用maven进行package报错如下:

原因:

当maven项目里面有用到JDK内部的一些类或者接口的时候,用maven编译一般会出现如下错误:

程序包:com.sun.xml.internal.bind.marshaller.CharacterEscapeHandler不存在。

解决方法如下:

添加maven-compiler-plugin插件,并且配置compilerArguments

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<compilerArgs>
						<arg>-XDignore.symbol.file</arg>
					</compilerArgs>
					<fork>true</fork>
				</configuration>
			</plugin>

 

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐