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

来源:互联网 发布:coc弓箭女皇升级数据 编辑:程序博客网 时间:2024/06/05 14:54

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包,因为我在编译的过程中除了报上面那个错误,还报了一个错。所以我添加了两个包。

原帖子在这里:[这里]

阅读全文
0 0
原创粉丝点击