maven install Compilation failure

mvn install 出现一下错误:

WARNING: Alternate user settings file: ource5 is invalid. Using default path.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building qs-data-processing-screen_crawler
[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 12 source files to /root/Workspaces/qsdata/screencrawler/target/classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

/root/Workspaces/qsdata/screencrawler/src/main/java/com/qsdata/screencrawler/bean/Condition.java:[53,2] annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
	@Override

/root/Workspaces/qsdata/screencrawler/src/main/java/com/qsdata/screencrawler/dao/ScreenDao.java:[30,11] generics are not supported in -source 1.3
(use -source 5 or higher to enable generics)
	public Map<String,Integer> getImageIds(){

/root/Workspaces/qsdata/screencrawler/src/main/java/com/qsdata/screencrawler/parse/TraficConditionParser.java:[41,18] generics are not supported in -source 1.3
(use -source 5 or higher to enable generics)
	public static Map<String, Integer> roadIds;

/root/Workspaces/qsdata/screencrawler/src/main/java/com/qsdata/screencrawler/parse/TraficConditionParser.java:[65,18] for-each loops are not supported in -source 1.3
(use -source 5 or higher to enable for-each loops)
			for (File file : imgFiles) {

/root/Workspaces/qsdata/screencrawler/src/main/java/com/qsdata/screencrawler/crawl/AbstractCrawler.java:[41,15] generics are not supported in -source 1.3
(use -source 5 or higher to enable generics)
	protected List<NameValuePair> fixedParams;

/root/Workspaces/qsdata/screencrawler/src/main/java/com/qsdata/screencrawler/util/FileUtil.java:[17,15] for-each loops are not supported in -source 1.3
(use -source 5 or higher to enable for-each loops)
			for (File f : file.listFiles()) {

/root/Workspaces/qsdata/screencrawler/src/main/java/com/qsdata/screencrawler/crawl/ScreenCrawler.java:[46,6] generics are not supported in -source 1.3
(use -source 5 or higher to enable generics)
		List<String> imgUrls = getScreenUrls(url);

/root/Workspaces/qsdata/screencrawler/src/main/java/com/qsdata/screencrawler/crawl/ScreenCrawler.java:[63,18] for-each loops are not supported in -source 1.3
(use -source 5 or higher to enable for-each loops)
		for (String url : imgUrls) {


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri Jun 17 16:38:27 CST 2011
[INFO] Final Memory: 13M/106M
[INFO] ------------------------------------------------------------------------


该错误是由于maven编译的时候使用了jdk1.3,而jdk1.3不支持范型.


错误原因:
(1)用mvn -v  查看maven版本

引用
Apache Maven 2.2.1 (rdebian-4)
Java version: 1.6.0_24
Java home: /usr/lib/jvm/java-6-sun-1.6.0.24/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.35-22-generic" arch: "amd64" Family: "unix"


版本依赖是1.6
(2)maven2.2.1 默认使用jdk1.3编译

解决办法:
已经迁移至新博客:

http://www.adintellig.com/maven-install-compilation-failure/

猜你喜欢

转载自binma85.iteye.com/blog/1092758
今日推荐