Maven을 통해 build를 하다보면 가끔 자바 버전의 하위호환성 문제로 인해 build가 되지 않을 때가 있다.
> 에러내용
에러내용중에 Java 버전과 관련된 내용이 포함되어 있음을 발견할 수 있다.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.000s
[INFO] Finished at: Sat May 08 11:06:22 KST 2010
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project HibernateEntity: Compilation failure: Compilation failure:
D:\workspace\HibernateEntity\src\main\java\kr\nextree\nexbay\domain\entity\User.java:[15,1] annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
@Entity
> 해결방법
pom.xml에 다음과 같이 maven compile plug-in을 선언하고 java 버전을 세팅해준다.
> 에러내용
에러내용중에 Java 버전과 관련된 내용이 포함되어 있음을 발견할 수 있다.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.000s
[INFO] Finished at: Sat May 08 11:06:22 KST 2010
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project HibernateEntity: Compilation failure: Compilation failure:
D:\workspace\HibernateEntity\src\main\java\kr\nextree\nexbay\domain\entity\User.java:[15,1] annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
@Entity
> 해결방법
pom.xml에 다음과 같이 maven compile plug-in을 선언하고 java 버전을 세팅해준다.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
Maven은 의존하여 사용하고 있는 라이브러리의 성격에 따라 사용범위를 지정할 수 있다.
JUnit과 같은 라이브러리는 테스트에만 사용하며 배포시에는 필요하지 않다.
라이브러시 사용범위에 따른 5가지 Scope의 의미
| Scope | 적용범위 |
| compile | scope를 지정하지 않은 경우 기본범위. 컴파일할 때도 사용되고, 배포할 때도 포함되어야 하는 라이브러리 |
| provided | 컴파일 시점에는 필요하지만, 배포할 때는 포함되지 않는 라이브러리. 예를 들어, servlet.jar는 서블릿컨테이너에서 제공되므로 컴파일시에는 필요하지만 배포될 필요는 없음 |
| runtime | 컴파일 시에는 사용되지 않지만 실행시에는 필요한 라이브러리 |
| test | 테스트 컴파일 및 테스트 실행 시에만 사용되는 라이브러리 예를들어, JUnit은 테스트시에만 필요함 |
| system | provided와 유사하나, jar파일을 저장소(repository)에서 검색하지 않음. 즉 jar파일을 직접 제공해 주어야 함 |

Prev
Rss Feed