본문 바로가기

Programming!

버전 맞추기 힘들다...

IDE 환경에서 문제없이 Application 이 실행되는데 EC2에 올라가면 main()을 찾을 수 없다고 내게 자꾸 토를 단다.

 

뭐지 왜지...

 

하.. 첨부터 디컴파일 해봤으면 바로 알 수 있는 내용인데 말이지.

 

1. Main Class 관련 

https://stackoverflow.com/questions/56861256/gradle-build-failed-main-class-name-has-not-been-configured-and-it-could-not-be

 

Gradle build failed: Main class name has not been configured and it could not be resolved

I am building a RESTful web service with Spring by following this guide. I am using grable to build the app but my build is failing. I used the "build gradle" command on a Windows 10 machine. Thi...

stackoverflow.com

 

이건 참고용

https://www.baeldung.com/spring-boot-main-class#gradle

 

https://docs.gradle.org/current/userguide/migrating_from_groovy_to_kotlin_dsl.html

 

Migrating build logic from Groovy to Kotlin

Declaring dependencies in existing configurations is similar to the way it’s done in Groovy build scripts, as you can see in this example: build.gradle plugins { id 'java-library' } dependencies { implementation 'com.example:lib:1.1' runtimeOnly 'com.exa

docs.gradle.org

2. asciidoctor Task 실행시 jdk 11(9+인듯) 오류 

Illegal reflective access by org.jruby.util.SecurityHelper

=>  3.x.x 로 수정. ( jvm 으로 기존 org.asciidoctor.gradle.AsciidoctorTask Deprecated 됨.)

plugins {
//    id("org.asciidoctor.jvm.convert") version "2.4.0"
    id("org.asciidoctor.jvm.convert") version "3.3.2"
}

 

3. asciidoctor 3.x 사용시 

plugins {
    id("org.asciidoctor.jvm.convert") version "3.3.2"
}
..


// 기존 asciidoctor 제거 
dependencies {
    ...
	// asciidoctor(...) // 제거
    ...
}


val snippetsDir = file("build/generated-snippets")
val asciiDoctor = tasks.withType<AsciidoctorTask> {
    inputs.dir(snippetsDir)
    dependsOn(tasks.test)
}

tasks.getByName<Jar>("jar") {
    enabled = false
}

tasks.named<BootJar>("bootJar") {
    enabled = true
    dependsOn(asciiDoctor)
    from("${asciiDoctor.first().outputDir}") {
        into("static/docs")
    }
    mainClass.set("xxxxxx.xxxx.XxxxApplicatonKt")
    archiveFileName.set("${archiveBaseName.get()}.${archiveExtension.get()}")
}