먼저 이클립스에 scala ide 를 설치한다.
이클립스에 scala ide 설치하기
eclipse 에서 help->eclipse market place 선택->“scala”로 검색->The Scala IDE for Eclipse 의 Install 버튼 클릭->Next->I accept~ 체크->Finish->설치완료 후 eclipse 재시작
Install m2eclipse-scala
Help->Install new software-> work with 에 http://alchim31.free.fr/m2e-scala/update-site 입력 후 엔터->설치-> eclipse 재시작
(참고:http://scala-ide.org/docs/tutorials/m2eclipse/index.html)
환경설정
eclipse 에서 Window->Preferences->Scala->Compiler 에서 target 을 java 에서 사용하는 jvm 버전과 동일하게 설정.
예) jvm-1.7
pom.xml 에 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
| <properties>
<java.version>1.7</java.version>
<scala-version>2.10.2</scala-version>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<scope>compile</scope>
<version>${scala-version}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.1.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
|
에러메시지 조치사항
pom.xml 에서 아래 에러 메시지 발생시
plugin execution not covered by lifecycle configuration net.alchim31
m2eclipse-scala 가 정상적으로 설치 되어있는지 확인한다.
(참고: http://stackoverflow.com/questions/13995236/avoid-eclipse-ignore-garbage-in-scala-maven-project)
updated 2013.10.4
Package Explorer 에서 Scala Library 가 포함되어 있지 않다면 Maven 에서 update project 를 한번 해준다.