Skip to main content

아티팩트를 저장소로 배포

Less than 1 minuteGradleSnippetsgradlegroovyideaintellij-ideaintellijexecutable-jarrepositorymaven-repositoryupload

아티팩트를 저장소로 배포 관련

Gradle > Snippets

Snippets

최종 war를 Maven 저장소로 배포

../<war으로 묶어 줄 모듈>/build.gradle

Groovy
plugins {
    id "java"
    id "war"
    id "maven-publish"
}

// ... 
dependencies {
    // ...
}

publishing {
    publications {
        maven(MavenPublication) {
            groupId = "<그룹ID>"
            artifactId = rootProject.name // 또는 최총 아티펙트명
            version = "버전명"
            from components.web

            pom {
                name = rootProject.name
                description = "..."
                url = "..."
                licenses {
                    license {
                        name = "..."
                    }
                }
                scm {
                    connection = "..."
                }
            }
        }
    }

    repositories {
        maven {
            url = repo.releaseUrl
            credentials {
                username = project.nexusUsername // gradle.properties에서 지정
                password = project.nexusPassword // gradle.properties에서 지정
            }
        }
    }
}

publish.dependsOn war

../gradle.properties

# nexus
#
# 아래 내용은 배포할 서버마다 다르므로 값 부여 방법만 참고
nexusUsername=admin
nexusPassword=admin123

.실행 시

gradlew <모듈명>:publish

이찬희 (MarkiiimarK)
Never Stop Learning.