Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 20413

Gradle Jar It hasn't found the main class

$
0
0

Hi guys.

I’m getting a little trouble when I want to run my application, once I have created my Jar, The error that I’m getting is like I have written above in the topic.

Here, I show you my root project:

±-- Project ‘:lab-myapp-api’
±-- Project ‘:lab-myapp-commons’
±-- Project ‘:lab-myapp-config’
±-- Project ‘:lab-myapp-model’
±-- Project ‘:lab-myapp-service’
— Project ‘:lab-myapp-starter’

Where sub project lab-myapp-starter is my spring boot context and this is I want to run. When I run the application from my IDE IntelliJ the applicatio. works and process all requests, but When I have created my jar and It tries to run the application with Jar I haven’t could.

This is my gradle build file of the project.

subprojects{
apply plugin: ‘java’

sourceCompatibility = 1.8

repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
}

dependencies {
    annotationProcessor 'org.projectlombok:lombok:1.18.10'
    compileOnly 'org.projectlombok:lombok:1.18.10'
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

jar {
    manifest {
        attributes(
                'Main-Class': 'com.mycompany.lab.myapp.starter.MyApplication'
        )
    }

    doFirst {
        manifest {
            if (!configurations.runtime.isEmpty()) {
                attributes('Class-Path':
                        configurations.runtime.collect{it.toURI().toString()}.join(' '))
            }
        }
    }
}

}

group ‘com.mycompany’
version ‘1.0-SNAPSHOT’

Any idea or solution about that?

Thanks a lot for you help.


Viewing all articles
Browse latest Browse all 20413

Latest Images

Trending Articles



Latest Images