1

I have a multi-project gradle build with Spring Boot structured per default gradle conventions.

root
   -- common
        -- src/main/java
   -- bootproject
        -- src/main/java

My current project is to (A) upgrade gradle from 5.x to 7.3.x and (B) use embedded tomcat with Spring Boot.

This is a project that has existed for many years and is Spring Boot but has always been deployed traditionally as a WAR file in Tomcat.

I have upgraded gradle to 7.3.3 following the gradle migration guide and have "common" building correctly (java-library). I am now trying to make "bootproject" build correctly again. I have migrated my build.gradle, and compilation happens correctly now but upon executing 'gradlew sub-project:build' I get the error:

Execution failed for task ':tx-main:bootWarMainClassName'. java.lang.IllegalArgumentException (no error message)

My ROOT build.gradle is simple:

    plugins {
        id "org.springframework.boot" version "2.6.3"
    }
    
    subprojects {
        apply plugin: 'java'
    
        group = 'com.blah'
        version = '2.1.1'
    
        repositories {
            mavenCentral()
}

There is a library sub-project (common) that builds fine.

The Spring Boot subproject build.gradle is:

plugins {
    id 'org.springframework.boot'
    id 'io.spring.dependency-management'
}

dependencies {
    implementation project(path:':common', configuration:'default')

    implementation 'org.springframework.boot:spring-boot-starter-web'

    implementation ...

}

The main class was originally set up to make the app conventionally deployed (extends SpringBootServletInitializer), but has been replaced with (taken directly from docs):

package com.blah;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

The compilation works, this class appears to be in the build/classpath so I don't understand why Gradle-Spring-Boot is not finding it. I have also tried explicitly identifying the class with the same result.

Unfortunately I find little documentation about multi-project gradle builds so I suspect that is part of the problem. Hopefully someone here can point me in the right direction as to what is wrong.

Thanks

Fedaykin
  • 51
  • 1
  • 4

1 Answers1

0

I discovered the issue here. We have custom code in /buildSrc that is apparently causing this.

Fedaykin
  • 51
  • 1
  • 4