아래의 build.gradle는 여기에서 사용한 build.gradle이다.
이 build.gradle를 보면 일단 한숨부터 나온다... 😵😵
plugins {
id 'java'
id 'maven-publish'
id 'signing'
}
group = ~~~
version = ~~~
sourceCompatibility = ~~~
repositories {
mavenCentral()
}
dependencies {
~~~~
}
test {
useJUnitPlatform()
}
task javadocJar(type: Jar) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
publishing {
publications {
maven(MavenPublication) {
artifactId = 'neis-api'
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = 'Neis Api'
description = 'Supporting to develop KOREA school service'
url = 'https://github.com/leeseojune53/neis-api'
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'leeseojune'
name = 'Seojune Lee'
email = 'sung07288346@gmail.com'
}
}
scm {
connection = 'scm:svn:http://foo.googlecode.com/svn/trunk/'
developerConnection = 'scm:svn:https://foo.googlecode.com/svn/trunk/'
url = 'http://foo.googlecode.com/svn/trunk/'
}
}
}
}
repositories {
maven {
name = "OSSRH"
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/leeseojune53/neis-api"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
signing {
useGpgCmd()
sign(publishing.publications)
}
천천히 이 코드를 뜯어보겠습니다.
프로젝트의 기능을 확장할 수 있다.
DSL(Domain Specific Language)이란? 특정 영역을 타겟하고 있는 언어를 말한다.
plugins : java, maven-publish, signing
Task는 gradle 명령으로 호출 실행 시킬 수 있는 것이다.
이제 위의 build.gradle를 대략적으로 이해할 수 있을것이다.
에잉,, 잘보고갑니다 ^^*~