2011-09-16 23 views
-1

当我作为Maven包运行时,出现此BUILD错误。但我不确定错误是什么。谁能帮忙?提前致谢。作为Maven包运行时编译失败

[INFO] Scanning for projects... 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Conference Organizer 
[INFO] task-segment: [package] 
[INFO] ------------------------------------------------------------------------ 
[INFO] [resources:resources {execution: default-resources}] 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] Copying 36 resources 
[INFO] [compiler:compile {execution: default-compile}] 
[INFO] Compiling 1 source file to C:\Users\Wallace\Desktop\co-app\co-app\target\classes 
[INFO] ------------------------------------------------------------------------ 
[ERROR] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Compilation failure 
C:\Users\Wallace\Desktop\co-app\co-app\src\main\java\com\alcatel\co\service\AdminControlService.java:[38,5] error: generics are not supported in -source 1.3 


[INFO] ------------------------------------------------------------------------ 
[INFO] For more information, run Maven with the -e switch 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 3 seconds 
[INFO] Finished at: Fri Sep 16 06:02:09 SGT 2011 
[INFO] Final Memory: 14M/34M 
[INFO] ------------------------------------------------------------------------ 

回答

2

“错误:泛型是不支持的-source 1.3”

即时猜测你的代码使用泛型和编译器被告知使用的Java 1.3不支持这样的。

编辑: 您可能必须至少使用Java 1.5的

<project> 
[...] 
    <build> 
    [...] 
    <plugins> 
    <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-compiler-plugin</artifactId> 
    <version>2.3.2</version> 
    <configuration> 
     <source>1.5</source> 
     <target>1.5</target> 
    </configuration> 
    </plugin> 
    </plugins> 
    [...] 
    </build> 
[...] 
</project> 
0

添加到您的Maven POM:

<build> 
    [...] 
    <plugins> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>2.3.2</version> 
     <configuration> 
      <!-- set compliance level here --> 
      <source>1.6</source> 
      <target>1.6</target> 
     </configuration> 
     </plugin> 
    </plugins> 
    [...] 
</build> 

BTW,Maven的当前版本假设1.5的默认合规水平。也许你应该升级到当前的Maven版本。

+0

对不起,我该如何添加?我看到了pom.xml。我添加了吗? – Wallace

+0

' 4.0.0 com.alcatel 共同应用 战争 0.0.1-SNAPSHOT 会议组织者 <先决条件> 2.2。 1 Wallace