mainClassName not found which is not needed
I am creating a library which doesn't have a main class at all. The library uses Spring which has application plugin which is looking for mainClassName. I added mainClassName with null, but I am looking for a better solution. I googled around and found that adding bootJar.enabled = false
will not look for mainClassName but it is not helping. Can someone help me out?
ext {
springBootVersion = '2.2.1.RELEASE'
satelliteVersion = '2.12.3'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath('org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE') {
exclude group: 'org.slf4j'
exclude module: 'spring-boot-starter-log4j'
}
}
}
plugins {
id 'java'
id 'groovy'
id 'idea'
id 'distribution'
}
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'application'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
repositories {
mavenLocal()
mavenCentral()
}
bootJar.enabled = false
apply plugin: 'maven-publish'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
version = System.getenv('CI') == 'drone' ? "1.0.${System.getenv('DRONE_BUILD_NUMBER')}" : "local"
tasks.validateYaml.enabled = false
dependencies {
implementation "org.springframework.boot:spring-boot-starter-mail:${springBootVersion}"
implementation group: 'com.google.guava', name: 'guava', version: '18.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact tasks.sourcesJar
}
}
}
configurations.all {
exclude module: 'spring-boot-starter-logging'
exclude group: 'ch.qos.logback'
exclude module: 'logback-access-spring-boot-starter'
}
I get the following error
A problem was found with the configuration of task ':startScripts' (type 'CreateStartScripts').
> No value has been specified for property 'mainClassName'.
Adding
startScripts.enabled = false
bootJar.enabled = false
distTar.enabled = false
solved my issue.Thanks