maven 编译 maven install 出错 com.sun.image.codec.jpeg不存在

1、问题?项目打包报错;

程序包com.sun.image.codec.jpeg不存在

在使用Hudson进行打包的过程中,因为我们使用了一个pdf文件产生缩略图的功能,倒置添加的源码文件在maven下面编译失败,失败提示信息为:程序包com.sun.image.codec.jpeg不存在 后来查看这个类文件的位置在jre/lib/rt.jar

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

  1. 然后查看了一下工程的java build path 里的libraries 下面maven depends 的jar包是不是缺少了,果然发现缺少jdk.tools-1.7.jar,  

先直接上解决方法:在项目的pom.xml 中增加以下maven依赖配置,再编译就


  1.    <dependency>  
  2.     <groupId>jdk.tools</groupId>  
  3.     <artifactId>jdk.tools</artifactId>  
  4.     <version>1.7</version>  
  5.     <scope>system</scope>  
  6.     <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>  
  7. </dependency>  



<build>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<compilerArguments>
                        <verbose/> <!-- 解决缺少包 -->

   <bootclasspath>${JAVA_HOME}\jre\lib\rt.jar;${JAVA_HOME}\jre\lib\jce.jar;${JAVA_HOME}\lib\tools.jar</bootclasspath>                    

                    </compilerArguments>

</configuration>
</plugin>
<plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-surefire-plugin</artifactId> 
        <version>2.19.1</version>
        <configuration> <!-- Tests are skipped. -->
          <skip>true</skip> 
        </configuration> 

      </plugin> 



[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building HTX3开发管理后台 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ aop-security ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 270 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ aop-security ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ aop-security ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\b\WorkSpaces\aop-security\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) @ aop-security ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ aop-security ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-war-plugin:2.2:war (default-war) @ aop-security ---
[INFO] Packaging webapp
[INFO] Assembling webapp [aop-security] in [D:\b\WorkSpaces\aop-security\target\aop-security-1.0.0]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\b\WorkSpaces\aop-security\src\main\webapp]
[INFO] Webapp assembled in [12377 msecs]
[INFO] Building war: D:\b\WorkSpaces\aop-security\target\aop-security-1.0.0.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ aop-security ---
[INFO] Installing D:\b\WorkSpaces\aop-security\target\aop-security-1.0.0.war to D:\mavenspaces\repo\com\casic\aop-security\1.0.0\aop-security-1.0.0.war
[INFO] Installing D:\b\WorkSpaces\aop-security\pom.xml to D:\mavenspaces\repo\com\casic\aop-security\1.0.0\aop-security-1.0.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35.504 s
[INFO] Finished at: 2018-04-11T13:51:37+08:00
[INFO] Final Memory: 16M/981M
[INFO] ---------------------------------------

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值