【Maven】Maven打包失败,程序包com.sun.deploy.net不存在

1.问题

用Maven打包的时候,失败,程序包com.sun.deploy.net不存在;

2.代码

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project fxrj-admin: Compilation failure: Compilation failure:
[15,26] 程序包com.sun.deploy.net不存在
[93,31] 找不到符号
[ERROR] 符号:   变量 URLEncoder
[ERROR] -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

这里写图片描述

3.方案

这里写图片描述
源文件跟换URLEncoder的jar包,使用URLEncoder(java.net)包;

4.第二个错误

接下来会报程序包com.sun.image.codec.jpeg不存在的错误

<!-- 编译插件 -->  
<plugin>  
    <groupId>org.apache.maven.plugins</groupId>  
    <artifactId>maven-compiler-plugin</artifactId>  
    <version>${maven-compiler.version}</version>  
    <configuration>  
        <source>${java.version}</source>  
        <target>${java.version}</target>  
        <encoding>${project.build.sourceEncoding}</encoding>  
            <compilerArguments>  
                  <verbose />  
              <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>  
        </compilerArguments>  
    </configuration>  
</plugin>  

原作者:
maven下面编译失败,失败提示信息为:程序包com.sun.image.codec.jpeg不存在
这个类文件的位置在jre/lib/rt.jar

而我们设置的java_home下面的lib/dt.jar中没有这个文件,导致编译失败。通过配置maven-compiler-plugin插件可以解决此问题。

在windows下面用;分隔,linux下面用:分隔。

配置中使用了两个jar包,因为我在编译的过程中除了报上面那个错误,还报了一个错。所以我添加了两个包。

原帖子在这里:[这里]

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

陶洲川

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值