# BAPWeb

## 빌드 방법
### Windows - git bash 예시
```bash
JAVA_HOME=/c/eactive/apps/jdk1.8.0_441
ANT_HOME=/c/eactive/apps/apache-ant-1.10.15

export PATH=${PATH}:${JAVA_HOME}/bin:${ANT_HOME}/bin

cd /c/eactive/workspaces/kjb-bap/BAPRMSClient
ant -s build-server.xml archive

cd /c/eactive/workspaces/kjb-bap/BAPWeb
ant -s build.xml war
```

### Jenkisn pipeline
```groovy
pipeline {
    agent { label 'apipod01' }  // 노트북망
    // agent { label 'apigwd01' } // 은행개발망

    parameters {
        string(name: 'BRANCH_NAME', defaultValue: 'master', description: 'Git branch to build (applies to both repos)')
    }

    environment {
        // Git 저장소 정보
        GIT_SERVER = '192.168.240.178:18081'
        GIT_CREDENTIALS_ID = 'git-ssh-credentials'

        // 프로젝트 디렉토리 구조
        PROJECT_HOME = '/Data/jenkins/eapim'

        JAVA_HOME = '/App/jenkins/jdks/jdk1.8.0_441'
        ANT_HOME  = '/App/jenkins/apache-ant-1.10.15'
        PATH = "${env.PATH}:${env.JAVA_HOME}/bin:${env.ANT_HOME}/bin"
    }


    stages {
        stage('Checkout BAPRMSClient') {
            steps {
                dir("${env.PROJECT_HOME}/BAPRMSClient") {
                    echo "▶ Checking out BAPRMSClient (${params.BRANCH_NAME})..."
                    git branch: "${params.BRANCH_NAME}",
                        credentialsId: "${env.GIT_CREDENTIALS_ID}",
                        url: "ssh://git@${env.GIT_SERVER}/eapim/baprmsclient.git"
                }
            }
        }

        stage('Checkout BAPWeb') {
            steps {
                dir("${env.PROJECT_HOME}/BAPWeb") {
                    echo "▶ Checking out BAPWeb (${params.BRANCH_NAME})..."
                    git branch: "${params.BRANCH_NAME}",
                        credentialsId: "${env.GIT_CREDENTIALS_ID}",
                        url: "ssh://git@${env.GIT_SERVER}/eapim/bapweb.git"
                }
            }
        }

        stage('Build BAPRMSClient') {
            steps {
                dir("${env.PROJECT_HOME}/BAPRMSClient") {
                    echo '▶ Building BAPRMSClient archive...'
                    sh 'ant -s build-server.xml archive'
                }
            }
        }

        stage('Build BAPWeb') {
            steps {
                dir("${env.PROJECT_HOME}/BAPWeb") {
                    echo '▶ Building BAPWeb WAR...'
                    sh 'ant -s build.xml war'
                }
            }
        }

        stage('Archive WAR Artifact') {
            steps {
                echo '▶ Archiving WAR file...'
                dir("${PROJECT_HOME}/BAPWeb/dist") {
                    archiveArtifacts artifacts: '*.war', fingerprint: true
                }
            }
        }
    }

    post {
        success {
            echo '✅ Build completed successfully. WAR archived.'
        }
        failure {
            echo '❌ Build failed. Check logs for details.'
        }
    }
}
```