You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
plugins {
id 'org.springframework.boot' version '2.4.0'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id "org.beryx.jlink" version "2.22.3"
id 'java'
id 'application'
}
What went wrong:
Execution failed for task ':app:bootJar'.
Failed to calculate the value of task ':app:bootJar' property 'mainClass'.
Main class name has not been configured and it could not be resolved
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
java modules project => openjdk 15 + spring boot 2.4 + gradle 2.22.3
reference ==> https://docs.gradle.org/current/samples/sample_java_modules_multi_project.html
build task error
build.gradle
buildscript {
repositories {
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}
}
plugins {
id 'org.springframework.boot' version '2.4.0'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id "org.beryx.jlink" version "2.22.3"
id 'java'
id 'application'
}
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
}
java {
sourceCompatibility = JavaVersion.VERSION_15
targetCompatibility = JavaVersion.VERSION_15
modularity.inferModulePath = true
}
version = '0.0.1-SNAPSHOT'
group = 'com.demo'
tasks.compileJava {
// use the project's version or define one directly
options.javaModuleVersion = provider { project.version }
}
dependencies {
testImplementation 'junit:junit:4.13'
}
application {
mainClass = 'com.demo/com.demo.App'
}
src/main/java/module-info.java
module com.demo {
requires spring.boot;
requires spring.boot.autoconfigure;
opens com.demo to spring.core;
exports com.demo;
}
src/main/java/com/demo/App.class
package com.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class,args);
}
}
build task
FAILURE: Build failed with an exception.
Execution failed for task ':app:bootJar'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1s
The text was updated successfully, but these errors were encountered: