Translate

[Maven][Java] 컴파일 시 annotations are not supported in -source 1.3 에러가 나는경우..



책을보며 Maven 공부중 Jetty 와 Servlet 부분을 보고있는데

mvn install 또는 mvn compile 할 시 다음과 같이 에러가 나왔다.



[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.017s
[INFO] Finished at: Mon Nov 17 13:43:44 KST 2014
[INFO] Final Memory: 7M/105M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project simple-webapp: Compilation failure
[ERROR] /home/lucifer/test/maven/simple-webapp/src/main/java/org/sonatype/mavenbook/web/SimpleServlet.java:[14,5] error: annotations are not supported in -source 1.3
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
lucifer@lucifer-Vostro-V13:~/test/maven/simple-webapp$





위와같이 Annotation 때문에 문제가 발생했다는 로그가 보인다.
Maven 3.0.4 사용중인데 pom.xml 에 아무런 설정없이 컴파일 하면 java 1.3 으로 컴파일을 하는듯 싶다.

pom.xml 에 다음과 같이 설정을 추가해 줬다.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.sonatype.mavenbook.ch05</groupId>
  <artifactId>simple-webapp</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>simple-webapp Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
      <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-servlet_2.4_spec</artifactId>
          <version>1.1.1</version>
          <scope>provided</scope>
      </dependency>
  </dependencies>
  <build>
    <finalName>simple-webapp</finalName>
      <plugins>
          <plugin>
              <artifactId>maven-compiler-plugin</artifactId>
              <configuration>
                  <source>1.5</source>
                  <target>1.5</target>
              </configuration>
          </plugin>
          <plugin>
              <groupId>org.mortbay.jetty</groupId>
              <artifactId>maven-jetty-plugin</artifactId>
          </plugin>
      </plugins>
  </build>
</project>


댓글