이 문서는 LGPL 2.1 라이선스를 따르는 mariadb-java-client(버전 2.7.12)의 빌드 방법을 안내합니다. 라이브러리의 소스 코드는 공개되어 있으며 누구나 자유롭게 빌드 및 수정할 수 있습니다.
# MariaDB Java Client 빌드 가이드 (Version 2.7.12)
## 📘 한국어 (Korean)
# MariaDB Java Client 빌드 가이드 (버전 2.7.12)
이 문서는 `mariadb-java-client` (버전 2.7.12) 라이브러리를 빌드하는 방법을 설명합니다.
## 사전 준비
빌드를 진행하기 전에 아래 필수 도구가 설치되어 있는지 확인하세요:
- **JDK 8 이상** (권장: OpenJDK 11 이상)
- **Apache Maven** (최신 버전 권장)
- **Git**
## 방법 1: jar 파일로 빌드
Maven 없이 빌드하는 경우, jar 파일로 빌드할 수 있습니다.
먼저, maven repository에서 jar 파일을 직접 다운로드 받습니다.
MariaDB Connector/J용 애플리케이션과 JAR을 Java에 추가합니다 CLASSPATH.
```sh
$ export CLASSPATH="/path/to/application:/path/to/mariadb-java-client-2.7.12.jar"
```
애플리케이션을 컴파일하세요:
```sh
$ javac App.java
```
Java 클래스를 실행합니다.
```sh
$ java App
```
## 방법 2: 소스 코드에서 직접 빌드
### 저장소 클론
먼저, 공식 `mariadb-java-client` 저장소를 GitHub에서 클론합니다:
```sh
git clone https://github.com/mariadb-corporation/mariadb-connector-j.git
cd mariadb-connector-j
git checkout 2.7.12
```
### 프로젝트 빌드
이 프로젝트는 **Maven**을 사용하여 빌드됩니다. 다음 명령어를 실행하여 라이브러리를 컴파일 및 패키징하세요:
```sh
mvn clean package
```
위 명령어를 실행하면 `target/` 디렉터리에 JAR 파일이 생성됩니다.
### 테스트 실행
빌드가 정상적으로 완료되었는지 확인하려면 테스트를 실행하세요:
```sh
mvn test
```
### 로컬 Maven 저장소에 설치
빌드한 JAR 파일을 로컬 Maven 저장소에 추가하려면 다음 명령어를 실행하세요:
```sh
mvn install
```
## 방법 3: Maven Repository를 이용한 빌드
Maven 중앙 저장소에서 `mariadb-java-client`를 직접 가져와 사용할 수도 있습니다.
### Maven을 사용하는 경우 (`pom.xml` 수정)
```xml
org.mariadb.jdbc
mariadb-java-client
2.7.12
```
### Gradle을 사용하는 경우
- **Kotlin DSL (`build.gradle.kts`)**
```kotlin
dependencies {
implementation("org.mariadb.jdbc:mariadb-java-client:2.7.12")
}
```
- **Groovy DSL (`build.gradle`)**
```gradle
dependencies {
implementation 'org.mariadb.jdbc:mariadb-java-client:2.7.12'
}
```
위 문서는 MariaDb 개발 가이드 문서를 참고하여 작성되었습니다: [MariaDB Connector/J를 사용한 애플리케이션 개발](https://mariadb.com/docs/server/connect/programming-languages/java/development/#Build_with_Maven)
* 공식 저장소: [MariaDB Java Client GitHub](https://github.com/mariadb-corporation/mariadb-connector-j)
* maven repository: [MariaDB Java Client » 2.7.12](https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client/2.7.12)
---
This document is intended to support compliance with the LGPL v2.1 license. The MariaDB Java Client (2.7.12) is distributed under this license, and source code is publicly available for review and modification.
# MariaDB Java Client Build Guide (Version 2.7.12)
## 📙 English
# MariaDB Java Client Build Guide (Version 2.7.12)
This document explains how to build the `mariadb-java-client` (version 2.7.12) library.
## Prerequisites
Before proceeding with the build, ensure that the following tools are installed:
- **JDK 8 or later** (Recommended: OpenJDK 11 or later)
- **Apache Maven** (Latest version recommended)
- **Git**
## 1. How to Build as a JAR file
If you are building without Maven, you can compile the JAR file manually.
First, download the JAR file directly from the Maven repository.
Then, add the MariaDB Connector/J JAR to your Java application's CLASSPATH.
```
$ export CLASSPATH="/path/to/application:/path/to/mariadb-java-client-2.7.12.jar"
```
Compile your application:
```
$ javac App.java
```
Run the Java class:
```
$ java App
```
## 2. How to Build from Source Code
### Clone the Repository
First, clone the official `mariadb-java-client` repository from GitHub:
```
git clone
cd mariadb-connector-j
git checkout 2.7.12
```
### Build the Project
This project is built using **Maven**. Run the following command to compile and package the library:
```
mvn clean package
```
After running this command, a JAR file will be generated in the `target/` directory.
### Run Tests
To verify that the build was successful, execute the following command:
```
mvn test
```
### Install to Local Maven Repository
To add the built JAR file to your local Maven repository, run:
```
mvn install
```
## 3. How to Build Using Maven Repository
You can also fetch `mariadb-java-client` directly from the Maven Central Repository.
### Using Maven (`pom.xml` Modification)
```xml
org.mariadb.jdbc
mariadb-java-client
2.7.12
```
### Using Gradle
- **Kotlin DSL (`build.gradle.kts`)**
```kotlin
dependencies {
implementation("org.mariadb.jdbc:mariadb-java-client:2.7.12")
}
```
- **Groovy DSL (`build.gradle`)**
```
dependencies {
implementation 'org.mariadb.jdbc:mariadb-java-client:2.7.12'
}
```
This document is based on the MariaDB development guide: [Developing Applications with MariaDB Connector/J](https://mariadb.com/docs/server/connect/programming-languages/java/development/#Build_with_Maven)
- Official repository: [MariaDB Java Client GitHub](https://github.com/mariadb-corporation/mariadb-connector-j)
- Maven repository: [MariaDB Java Client » 2.7.12](https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client/2.7.12)