Difference between revisions of "Maven Project 생성"
Jump to navigation
Jump to search
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=== Karel을 위한 프로젝트 생성 === | === Karel을 위한 프로젝트 생성 === | ||
아래 그림과 같이 새로운 프로젝트를 생성한다. | |||
<gallery> | <gallery> | ||
file:maven-01.png | 1. 새로운 프로젝트를 생성한다. 탐색기 MAVEN에서 +를 누른 후 maven-archetype-quickstart 선택 | file:maven-01.png | 1. 새로운 프로젝트를 생성한다. 탐색기 MAVEN에서 +를 누른 후 maven-archetype-quickstart 선택 | ||
Line 13: | Line 15: | ||
=== pom.xml에 Karel 라이브러리 추가 === | === pom.xml에 Karel 라이브러리 추가 === | ||
Maven에서 프로젝트에 대한 명세가 pom.xml에 기술되어 있다. 여기에서 필요한 항목을 추가하도록 한다. | |||
* 먼저 Java 1.6으로 컴파일, 실행을 해야 한다. 이것은 아래 명세에서 다음을 변경한다. | |||
<syntaxhighlight lang="xml"> | |||
<maven.compiler.source>1.6</maven.compiler.source> | |||
<maven.compiler.target>1.6</maven.compiler.target> | |||
</syntaxhighlight> | |||
* 두 번째로 Karel.jar와 Hufs-karel.jar를 다운로드 받는다. 그리고 방금 만든 프로젝트 폴더에 <code>lib</code> 폴더를 생성한 후, 이 폴더에 다운로드 받은 두 개의 jar 파일을 이 폴더에 저장한다. | |||
* 세 번째로 Stanford Karel 라이브러리를 프로젝트에서 사용할 수 있도록 추가한다. dependencies 엘리먼트에 다음을 추가한다. 여기서 groupId와 artifactId는 적당한 이름으로 저장하도록 한다. version도 1.0으로 적절하게 지정한다. systemPath에서 project.basedir은 프로젝트가 있는 최상위 폴더를 뜻한다. | |||
<syntaxhighlight lang="xml"> | |||
<dependency> | |||
<groupId>karel</groupId> | |||
<artifactId>stanford</artifactId> | |||
<version>1.0</version> | |||
<scope>system</scope> | |||
<systemPath>${basedir}/lib/Karel.jar</systemPath> | |||
</dependency> | |||
</syntaxhighlight> | |||
* 마지막으로 Hufs Karel 라이브러리를 다음과 같이 추가한다. | |||
<syntaxhighlight lang="xml"> | |||
<dependency> | |||
<groupId>karel</groupId> | |||
<artifactId>hufs</artifactId> | |||
<version>1.0</version> | |||
<scope>system</scope> | |||
<systemPath>${basedir}/lib/Hufs-karel.jar</systemPath> | |||
</dependency> | |||
</syntaxhighlight> | |||
=== pom.xml에서 수정하는 부분 === | |||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
... | ... | ||
Line 30: | Line 65: | ||
</dependency> | </dependency> | ||
<dependency> | <dependency> | ||
<groupId> | <groupId>karel</groupId> | ||
<artifactId> | <artifactId>stanford</artifactId> | ||
<version>1.0</version> | <version>1.0</version> | ||
<scope>system</scope> | <scope>system</scope> | ||
<systemPath>${ | <systemPath>${basedir}/lib/Karel.jar</systemPath> | ||
</dependency> | </dependency> | ||
<dependency> | |||
<groupId> | <groupId>karel</groupId> | ||
<artifactId> | <artifactId>hufs</artifactId> | ||
<version>1.0</version> | <version>1.0</version> | ||
<scope>system</scope> | <scope>system</scope> | ||
<systemPath>${ | <systemPath>${basedir}/lib/Hufs-karel.jar</systemPath> | ||
</dependency> | </dependency> | ||
</dependencies> | </dependencies> |
Latest revision as of 03:21, 4 November 2022
Karel을 위한 프로젝트 생성
아래 그림과 같이 새로운 프로젝트를 생성한다.
pom.xml에 Karel 라이브러리 추가
Maven에서 프로젝트에 대한 명세가 pom.xml에 기술되어 있다. 여기에서 필요한 항목을 추가하도록 한다.
- 먼저 Java 1.6으로 컴파일, 실행을 해야 한다. 이것은 아래 명세에서 다음을 변경한다.
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
- 두 번째로 Karel.jar와 Hufs-karel.jar를 다운로드 받는다. 그리고 방금 만든 프로젝트 폴더에
lib
폴더를 생성한 후, 이 폴더에 다운로드 받은 두 개의 jar 파일을 이 폴더에 저장한다.
- 세 번째로 Stanford Karel 라이브러리를 프로젝트에서 사용할 수 있도록 추가한다. dependencies 엘리먼트에 다음을 추가한다. 여기서 groupId와 artifactId는 적당한 이름으로 저장하도록 한다. version도 1.0으로 적절하게 지정한다. systemPath에서 project.basedir은 프로젝트가 있는 최상위 폴더를 뜻한다.
<dependency>
<groupId>karel</groupId>
<artifactId>stanford</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/Karel.jar</systemPath>
</dependency>
- 마지막으로 Hufs Karel 라이브러리를 다음과 같이 추가한다.
<dependency>
<groupId>karel</groupId>
<artifactId>hufs</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/Hufs-karel.jar</systemPath>
</dependency>
pom.xml에서 수정하는 부분
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>karel</groupId>
<artifactId>stanford</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/Karel.jar</systemPath>
</dependency>
<dependency>
<groupId>karel</groupId>
<artifactId>hufs</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/Hufs-karel.jar</systemPath>
</dependency>
</dependencies>
...