-1

当我作为 Maven 包运行时出现此 BUILD 错误。但我不确定是什么错误。任何人都可以帮忙吗?提前致谢。

[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] ------------------------------------------------------------------------
4

2 回答 2

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>
于 2011-09-16T22:13:09.587 回答
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>

顺便说一句,当前版本的 Maven 假定 1.5 作为默认合规级别。也许您应该升级到当前的 Maven 版本。

于 2011-09-16T22:20:06.327 回答