Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build task error #3

Open
xfmyh opened this issue Nov 30, 2020 · 0 comments
Open

build task error #3

xfmyh opened this issue Nov 30, 2020 · 0 comments

Comments

@xfmyh
Copy link

xfmyh commented Nov 30, 2020

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/' }

jcenter()

}

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'

implementation 'com.google.guava:guava:29.0-jre'

implementation group: 'org.springframework.boot', name: 'spring-boot-starter'
//implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security'
implementation (group: 'org.springframework.boot', name: 'spring-boot-starter-web'){
    exclude(module: 'spring-boot-starter-tomcat')
}
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-undertow', version: '2.4.0'

}

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

Configure project :app
Using insecure protocols with repositories has been deprecated. This is scheduled to be removed in Gradle 7.0. Switch Maven repository 'maven(http://maven.aliyun.com/nexus/content/groups/public/)' to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/6.7.1/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.

Task :app:compileJava UP-TO-DATE
Task :app:processResources UP-TO-DATE
Task :app:classes UP-TO-DATE
Task :app:bootJarMainClassName UP-TO-DATE
Task :app:bootJar FAILED
4 actionable tasks: 1 executed, 3 up-to-date

FAILURE: Build failed with an exception.

  • 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.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant