Maven工程打包时出现 [INFO] Compilation failure 问题解决办法
来源:互联网 发布:软件项目介绍费 编辑:程序博客网 时间:2024/05/17 18:01
[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building brandCtr Maven Webapp[INFO] task-segment: [package][INFO] ------------------------------------------------------------------------[INFO] [resources:resources][WARNING] Using platform encoding (utf-8 actually) to copy filtered resources, i.e. build is platform dependent![INFO] Copying 2 resources[WARNING] POM for 'org.springframework:spring-transaction:pom:3.0.5.RELEASE:compile' is invalid. It will be ignored for artifact resolution. Reason: Failed to validate POM for project org/springframework:spring-transaction at Artifact [org.springframework:spring-transaction:pom:3.0.5.RELEASE:compile][WARNING] POM for 'org.springframework:spring-transaction:pom:3.0.5.RELEASE:compile' is invalid. It will be ignored for artifact resolution. Reason: Failed to validate POM for project org/springframework:spring-transaction at Artifact [org.springframework:spring-transaction:pom:3.0.5.RELEASE:compile][INFO] [compiler:compile][INFO] Compiling 9 source files to D:\eclipse-jee\workspace\brandCtr\target\classes[INFO] ------------------------------------------------------------------------[ERROR] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Compilation failureD:\eclipse-jee\workspace\brandCtr\src\main\java\dao\IQueryDAO.java:[12,5] -source 1.3 涓笉鏀寔娉涘瀷锛堣浣跨敤 -source 5 鎴栨洿楂樼増鏈互鍚敤娉涘瀷锛?List<Adzone> getAdzoneListByTimeList(List<Integer> timeList);D:\eclipse-jee\workspace\brandCtr\src\main\java\util\TimeUtil.java:[36,19] -source 1.3 涓笉鏀寔娉涘瀷锛堣浣跨敤 -source 5 鎴栨洿楂樼増鏈互鍚敤娉涘瀷锛?public static List<Integer> getResentTimeList(int days) {D:\eclipse-jee\workspace\brandCtr\src\main\java\web\QueryController.java:[29,1] -source 1.3 涓笉鏀寔娉ㄩ噴锛堣浣跨敤 -source 5 鎴栨洿楂樼増鏈互鍚敤娉ㄩ噴锛?@ControllerD:\eclipse-jee\workspace\brandCtr\src\main\java\web\QueryController.java:[65,6] -source 1.3 涓笉鏀寔娉涘瀷锛堣浣跨敤 -source 5 鎴栨洿楂樼増鏈互鍚敤娉涘瀷锛?List<Integer> timeList = TimeUtil.getResentTimeList(days);D:\eclipse-jee\workspace\brandCtr\src\main\java\web\QueryController.java:[72,21] -source 1.3 涓笉鏀寔 for-each 寰幆锛堣浣跨敤 -source 5 鎴栨洿楂樼増鏈互鍚敤 for-each 寰幆锛?for (Adzone adzone : adzoneList) {D:\eclipse-jee\workspace\brandCtr\src\main\java\dao\QueryDAOImpl.java:[19,2] -source 1.3 涓笉鏀寔娉ㄩ噴锛堣浣跨敤 -source 5 鎴栨洿楂樼増鏈互鍚敤娉ㄩ噴锛?@OverrideD:\eclipse-jee\workspace\brandCtr\src\main\java\dao\QueryDAOImpl.java:[20,12] -source 1.3 涓笉鏀寔娉涘瀷锛堣浣跨敤 -source 5 鎴栨洿楂樼増鏈互鍚敤娉涘瀷锛?public List<Adzone> getAdzoneListByTimeList(List<Integer> timeList){D:\eclipse-jee\workspace\brandCtr\src\main\java\dao\QueryDAOImpl.java:[23,19] -source 1.3 涓笉鏀寔 for-each 寰幆锛堣浣跨敤 -source 5 鎴栨洿楂樼増鏈互鍚敤 for-each 寰幆锛?for(Adzone adzone:adzoneList){[INFO] ------------------------------------------------------------------------[INFO] For more information, run Maven with the -e switch[INFO] ------------------------------------------------------------------------[INFO] Total time: 1 second[INFO] Finished at: Thu Nov 15 16:23:12 CST 2012[INFO] Final Memory: 11M/20M[INFO] ------------------------------------------------------------------------
问题解析:
该错误是由于maven编译的时候使用了jdk1.3,而jdk1.3不支持泛型;
solution:
(1) 使用mvn -v 查看Maven版本
Maven version: 2.0.10Java version: 1.6.0_10-rc2OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"依赖的Java 版本是1.6.0_10-rc2(2)maven2.0.10默认使用的是jdk1.3,而当前Maven要依赖 1.6版本,
解决办法:
可知原工程在 编译(compile)的阶段出现问题,检查 Maven 依赖的POM.XML文件中是否配置有 Maven编译的插件
如果没有可按如下配置编译插件
<build> <plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.6</source><target>1.6</target></configuration></plugin></plugins><finalName>brandCtr</finalName></build>
配置好之后,重新在命令行中执行 mvn package 命令,第一遍可能还会出现错误,多执行几遍,便会打包成功,(一般执行第二遍时即可打包成功)。注:可以参看这篇blog:http://binma85.iteye.com/blog/1092758
- Maven工程打包时出现 [INFO] Compilation failure 问题解决办法
- Maven导入工程出现的一些问题解决办法
- maven工程创建相关问题解决办法
- maven打包异常!COMPILATION ERROR
- Compilation failure
- springboot项目打包后运行出现问题解决办法
- maven clean失败([INFO] BUILD FAILURE )
- Maven Package Compilation Error错误问题解决方案
- junit出现问题解决办法
- 解决mvn compile [INFO] Compilation failure Unable to locate the Javac Compiler in:
- 安装apk时出现错误Failure [INSTALL_FAILED_DEXOPT]问题解决的方法
- 安装apk时出现错误Failure [INSTALL_FAILED_DEXOPT]问题解决的方法
- 安装apk时出现错误Failure [INSTALL_FAILED_DEXOPT]问题解决的方法
- 安装apk时出现错误Failure [INSTALL_FAILED_DEXOPT]问题解决的方法
- 安装apk时出现错误Failure [INSTALL_FAILED_DEXOPT]问题解决的方法
- 运行maven install命令时出现错误(BUILD FAILURE)
- 使用maven时出现Failure to transfer 错误的解决方法
- maven 工程简单打包
- Windows7在Eclipse中配置Python+OpenCV
- 项目1-调用函数(2)
- 第十二周任务二—分段函数求职(运用函数)
- 星号图 斜的
- ARM GNU 汇编伪指令简介
- Maven工程打包时出现 [INFO] Compilation failure 问题解决办法
- localtime 和 localtime_r
- 求解!!!(想要求的是金字塔形状的) 星星
- 函数求“*”图
- 12864液晶模块驱动
- js 获取、更改HTML元素属性
- 1到n的阶乘和
- Uncaught cannot call methods on listview prior to initialization; 在刷新动态内容时报错的解决方案
- POJ 1845 数论