spring - Maven错误 "annotations are not supported....."

标签 spring netbeans jakarta-ee maven

这是最烦人的错误之一?我能理解的是我使用的是较低版本的Java进行编译。如何为maven指定java版本?

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project springAopMavenDemo: Compilation failure D:\JAVA Stuffs\projects\springAopMavenDemo\src\main\java\service\EmployeeServiceImpl.java:[13,1] annotations are not supported in -source 1.3 (use -source 5 or higher to enable annotations) @Service -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

我真的很感谢任何帮助......我正在使用 NetBeans 7.0 和 Maven 3

最佳答案

你需要告诉maven源代码应该编译到哪个版本的java

<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>

http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html

关于spring - Maven错误 "annotations are not supported.....",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6315781/

相关文章:

java - 在 Netbeans 的 Maven 项目中设置依赖项

java - 将运行时(元)数据传递给 CDI 中的生产者方法

java - 什么是热刷新?

java - 当接收实体的更新时,如何访问不应该理解传入 DTO 的类中的先前值?

node.js - OpenID + API REST + Node 服务器

java - 使用 Spring 进行任务调度,并将 cron 数据存储在实体中

c++ - 我应该将 .hpp 和 .cpp 放在同一个折叠中还是分别放在 ./src 和 ./hdr 中?

java - 处理: fill(int) VS fill(color) in netbeans

使用自动完成而不是插入时,netbeans 会替换变量名称

java - Eclipse 上的 Glassfish 。收集要安装的项目时发生错误