Spark, IntellJ SBT SDK

Jeonghak Cho·2025년 8월 11일

Spark

목록 보기
11/12

윈도우의 파일시스템을 WSL 에게 공유

'/mnt/c/' 뒤에 윈도우 경로 줄경우 WSL에서 윈도우 파일 시스템 접근 가능

예를 들어 c:/workspace/kafka-stream 가 sbt project 라면, wsl 내에서 아래로 이동해서 sbt 컴파일이 가능하다.

cd /mnt/c/workspace/kafka-stream

root@DESKTOP-SCOK45O:/mnt/c/workspace/kafka-stream# sbt assembly
[info] welcome to sbt 1.11.4 (Ubuntu Java 11.0.27)
[info] loading settings for project kafka-stream-build from plugins.sbt...
[info] loading project definition from /mnt/c/workspace/kafka-stream/project
[info] loading settings for project kafka-stream from build.sbt...
[info] set current project to HelloWorldStream (in build file:/mnt/c/workspace/kafka-stream/)
[info] 22 file(s) merged using strategy 'Rename' (Run the task at debug level to see the details)
[info] 3 file(s) merged using strategy 'Deduplicate' (Run the task at debug level to see the details)
[info] 227 file(s) merged using strategy 'Discard' (Run the task at debug level to see the details)
[info] Built: /mnt/c/workspace/kafka-stream/target/scala-2.12/HelloWorldStream-assembly-0.1.jar
[info] Jar hash: 2a30eeab1d198d64c028a1e52fa37ad5ea827b24
[success] Total time: 9 s, completed Aug 11, 2025, 6:30:52 PM

WSL의 파일시스템을 윈도우에게 공유

가령 Ubuntu-20.04이라는 이름의 WSL의 현재 폴더가 /root 일 경우 '\wsl.localhost\Ubuntu-20.04' 로 접근 가능하다.

pwd
/root/spark

sbt new scala/scala-seed.g8
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
A minimal Scala project.

name [Scala Seed Project]: kafka-stream

Template applied in /root/spark/./kafka-stream

인텔리제이 프로젝트 생성

Community 버전의 경우 SDK 가 WSL 에 있을 경우 프로젝트 접근이 불가하다. 이 경우 윈도우에서 코드 관리하고 sbt는 wsl에서 윈도우 파일 시스템에 접근해서 관리한다.

SBT를 윈도우에 설치해서 사용하는 방법은 다음과 같은 문제를 가진다.

Spark 실행 환경 불일치

SBT로 빌드한 JAR는 문제 없지만, Spark 실행이 리눅스(WLS/VM)에서 돌아가면 경로·파일명 차이 가능.

리눅스 전용 라이브러리/스크립트 테스트 불가

예: HDFS 경로(hdfs://), chmod/ln 같은 유닉스 명령 테스트 안 됨.

윈도우 경로 문제

Spark, Hadoop 쪽은 C:\ 경로를 싫어하고 file:/// 리눅스 형식을 요구하는 경우가 있음.

0개의 댓글