Charliewolf 2020-01-05
本文环境:MacOS
程序运行没有问题,但在 maven 打包时,报了如下错误:
致命错误: 在类路径或引导类路径中找不到程序包 java.lang[INFO] -------------------------------------------------------------[ERROR] COMPILATION ERROR : [INFO] -------------------------------------------------------------[ERROR] An unknown compilation problem occurred
难道 maven-compiler-plugin 插件配置错了?如下是我的配置信息
<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> <encoding>UTF-8</encoding> <compilerArguments> <verbose/> <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath> </compilerArguments> </configuration> </plugin> </plugins></build>
搜索后,发现 Linux/Macos 环境下配置中的分隔符是不一样的:
Windows用 ; 做分隔符
<bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
Mac/Linux用 : 做分隔符
<bootclasspath>${java.home}/lib/rt.jar:${java.home}/lib/jce.jar</bootclasspath>