메이븐 : 프로젝트를 진행하면서 사용하는 수많은 라이브러리들을 관리해주는 도구
프론트엔드 개발자로서 처음으로 Java Spring Boot 프로젝트를 WSL 환경에서 실행하려다 마주한 문제들과 해결 과정을 공유한다. 특히 폐쇄망 환경에서 Maven(넥서스) 프로젝트를 실행하고 DB에 연결하는 과정에서 겪은 시행착오를 정리한다.
분명 나는 다시 시행착오를 마주할 것이기에... 미래의 나를 위해

WSL(Windows Subsystem for Linux)에서 Spring Boot 애플리케이션을 실행했을 때, Amazon Aurora MySQL DB 접근이 거부되는 현상이 발생했다.
SDK 맞추느라 실행도 겨우했는데, DB가 나를 튕겨낸다.
내부망 컴퓨터는 고정 IP를 사용한다. wsl은 가상 IP를 가진다. wsl IP !== static IP
//error
Caused by: java.sql.SQLException: Access denied for user 'id'@'10.11.5.168' (using password: YES)내 ID주소는 127 머시긴데 id와 10.11 머시기 ip가 매핑되어 있었다.
172.x.x.x 대역의 가상 IP 할당 10.11.2.168 같은 고정 IP # WSL에서 IP 확인
hostname -I
# 출력: 172.30.98.229 (가상 IP)
# Windows에서 IP 확인
ipconfig
# 출력: 10.11.5.168 (내부망 고정 IP)wsl IP로 DB에 접근요청하니 당연 안되는 게 맞았다.
netsh portproxy를 통한 포트포워딩은 인바운드(외부→WSL) 트래픽에만 유효하다. 반대로 WSL에서 DB로 나가는 아웃바운드 트래픽의 발신 IP는 변경할 수 없어 근본적인 해결책이 되지 못했다.
Windows 네이티브 환경으로 프로젝트 이전을 선택했다. Windows에서 직접 실행하면 내부망 IP(10.11.5.168)로 DB에 접근하므로 화이트리스트 문제가 자동 해결된다. 당연히 알았지만 개발자의 오기로 wsl에서 연결할 수 없나 수도없이 알아봤다. 근데 포기 하는 것도 미덕이다.
프로젝트를 Windows로 옮긴 후, IntelliJ에서 빌드 시 다음 오류 발생:
java: source value 8 is obsolete and will be removed in a future release
java: pattern matching in instanceof is not supported in -source 8pom.xml에는 Java 21로 명시되어 있는데 Java 8로 컴파일되는 이상 현상이다.
Per-module bytecode version에 특정 모듈이 8로 고정되어 있음 .idea/compiler.xml 파일에 이전 설정이 남아있었음 File > Settings > Build, Execution, Deployment > Compiler > Java Compiler21 선택 jcafe 모듈의 8 삭제 File > Project Structure (Ctrl+Alt+Shift+S)21 선택 21 선택 File > Invalidate Caches / Restart모든 옵션 체크 후 재시작
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>21</source>
<target>21</target>
<release>21</release>
</configuration>
</plugin>
</plugins>
</build>Windows로 프로젝트를 옮긴 직후 Maven 빌드 시 401 Unauthorized 에러가 발생했음:
Non-resolvable import POM: Could not transfer artifact
org.springframework.boot:spring-boot-dependencies:pom:3.3.5
status code: 401, reason phrase: Unauthorized~/.m2/settings.xml에 Nexus 인증 정보가 설정되어 있었음 # WSL 터미널에서
cp ~/.m2/settings.xml /mnt/c/Users/[사용자명]/.m2/또는 Windows 탐색기에서:
\\wsl$\Ubuntu\home\hoya\.m2\settings.xml
→ C:\Users\[사용자명]\.m2\<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
<servers>
<server>
<id>nexus</id>
<username>nexus_username</username>
<password>nexus_password</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>https://lgcnexus.jejuair.net/repository/central/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<url>https://lgcnexus.jejuair.net/repository/central/</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>중요: <server>의 <id>와 pom.xml의 repository <id>가 일치해야 한다.
# 실패 캐시 삭제
rmdir /s /q "%USERPROFILE%\.m2\repository\org\springframework"인텔리제이 메이븐 탭에서 동기화를 누른다.
clear - install
Windows 환경에서는 시스템 환경 변수 설정 필수:
시스템 변수:
JAVA_HOME = C:\Program Files\Java\jdk-21
Path = %JAVA_HOME%\binjava -versionFile > Settings > Build, Execution, Deployment > Build Tools > MavenC:\Users$$사용자명]\.m2\settings.xml C:\Users$$사용자명]\.m2\repository server:
address: 0.0.0.0
port: 18000
spring:
datasource:
url: jdbc:mysql://aurora-db-endpoint:3306/database_name
username: db_user
password: db_password
driver-class-name: com.mysql.cj.jdbc.Driver# Spring Boot 실행
mvn spring-boot:run
# 또는 IntelliJ Run Configuration에서 실행정상 실행 시 로그:
:: Spring Boot :: (v3.3.5)
Starting AircafeApplication using Java 21.0.8
The following 1 profile is active: "local"
Started AircafeApplication in 3.2 seconds| 항목 | WSL | Windows |
|---|---|---|
| 네트워크 IP | 가상 IP (172.x.x.x) | 내부망 고정 IP |
| DB 화이트리스트 | ❌ 등록 어려움 | ✅ 정상 작동 |
| 포트포워딩 | 복잡 | 불필요 |
| 설정 이전 | 쉬움 | 환경변수 설정 필요 |
.m2/repository 삭제 > mvn clean install -U 프론트엔드 개발자 입장에서 Java Spring Boot 환경 구축은 생소했지만, 네트워크 구조와 빌드 도구의 동작 원리를 이해하는 좋은 기회였다. api가 오는 원초적인 곳!
특히 폐쇄망 환경에서는:
이 세 가지가 가장 중요했다.
같은 문제로 고민하시는 분들께 도움이 되길 바란다!