Files
create-spring-app/README.md

102 lines
3.3 KiB
Markdown

# @kri/create-spring-app
KRI 표준 Spring Boot 프로젝트 생성 CLI입니다.
## 기본 구성
- Java 17
- Spring Boot 3.5.7
- Gradle Groovy DSL / Gradle Wrapper 8.14.3
- `com.kri.common:starter:beta.1.6.4`
- JPA + QueryDSL + JdbcTemplate 벌크 처리 예제
- EmbeddedId 복합키 예제
- MyBatis 선택 설치
- MySQL 또는 MSSQL 선택
- JWT/Security와 API Key는 공용 Starter 설정으로 활성화
- Scheduler, 파일 저장소, 정적 리소스 설정 예제
- Jenkinsfile 및 systemd 서비스 예제
## 개발
```powershell
npm install
npm run typecheck
npm run build
```
## 로컬 실행 테스트
```powershell
node .\dist\cli.js sample-server --yes --skip-build
```
전체 생성 및 Gradle 빌드:
```powershell
node .\dist\cli.js sample-server --yes
```
## 배포 후 사용
```powershell
npx @kri/create-spring-app sample-server
```
## 옵션
```text
--base-package <package> 기본 패키지
--description <text> 프로젝트 설명
--project-type <type> requested-project|internal-service|shared-service
--agent-project-id <id> 하네스 프로젝트 ID (기본: 프로젝트명 slug)
--harness-root <path> 중앙 Agent Harness 저장소 경로
--agent-registration <shared|local>
중앙 등록 범위 (기본 shared)
--port <number> 서버 포트 (기본 8080)
--database mysql|mssql DB 종류 (기본 mysql)
--mybatis MyBatis 예제 포함
--repo-url <url> Gitea 저장소 URL
--app-root <path> Ubuntu 배포 경로
--service-name <name> systemd 서비스 이름
--branch <name> 배포 브랜치 (기본 master)
--agent-label <label> Jenkins Agent label (기본 ubuntu-build)
--maven-credential-id <id> Jenkins Maven Credential ID
--target-dir <path> 생성 경로
--yes, -y 질문 없이 기본값 사용
--skip-build Gradle build 생략
--skip-agent-compose 하네스 자동 등록·합성·검증 생략
--no-jenkins Jenkinsfile 생성 안 함
--force 비어 있지 않은 대상 폴더 사용
--help, -h 도움말
```
`--yes` 사용 시 프로젝트 유형은 `requested-project`입니다.
## Agent Harness
생성 프로젝트에는 `.agent/profile.yml`, `.agent/project.md`, `.gitattributes`가 항상 포함됩니다.
중앙 하네스는 다음 순서로 탐색합니다.
1. `--harness-root`
2. `KRI_AGENT_HARNESS_ROOT` 환경변수
3. 생성 경로의 상위 디렉터리
하네스를 발견하면 기본적으로 프로젝트를 공유 `workspace.yml`에 등록하고 `compose`, `verify`를 실행합니다. 일회성 로컬 등록은 `--agent-registration local`로 선택할 수 있습니다. 하네스를 찾지 못해도 프로젝트 생성은 완료되며, 이 경우 `.agent` 원본을 중앙 하네스에서 나중에 등록·합성해야 합니다. 중앙 저장소와 생성 프로젝트의 Git 커밋은 자동으로 수행하지 않습니다.
## Gitea Maven 인증
개발자 PC의 `%USERPROFILE%\.gradle\gradle.properties`:
```properties
giteaUser=사용자명
giteaToken=Gitea토큰
```
또는 환경변수:
```text
GITEA_MAVEN_USER
GITEA_MAVEN_TOKEN
```