Problem

Task with name 'processAot' not found in multi-modules project, but other tasks like bootBuildImage are normal. The sample for reproducing the problem https://github.com/zgqq/spring-boot-native-sample

Config

subprojects { t ->
    repositories {
        mavenCentral()
        maven { url 'https://repo.spring.io/milestone' }
    }

        apply plugin: 'io.spring.dependency-management'
        apply plugin: 'org.springframework.boot'
    apply plugin: 'java'

    tasks.named('bootBuildImage') {
        buildpacks =  ['gcr.io/paketo-buildpacks/bellsoft-liberica:9.9.0-ea', 'gcr.io/paketo-buildpacks/java-native-image']
    }


    tasks.named('test') {
        useJUnitPlatform()
    }


    tasks.named("processAot") {
        setArgs(["spring"])
    }
}

Environment

❯ ./gradlew --version

------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------

Build time:   2022-08-05 21:17:56 UTC
Revision:     d1daa0cbf1a0103000b71484e1dbfe096e095918

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          17.0.5 (BellSoft 17.0.5+8-LTS)
OS:           Mac OS X 12.6 aarch64


~/Downloads/demo 2 main
❯ java --version
openjdk 17.0.5 2022-10-18 LTS
OpenJDK Runtime Environment GraalVM 22.3.0-dev (build 17.0.5+8-LTS)
OpenJDK 64-Bit Server VM GraalVM 22.3.0-dev (build 17.0.5+8-LTS, mixed mode, sharing)

~/Downloads/demo 2 main
❯ uname -a
Darwin MacBook-Air 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:07 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8110 arm64

Comment From: mhalbritter

The task processAot is created by the plugin org.springframework.boot.aot. This plugin will be automatically added when you use the native build tools. To fix your problem, add

apply plugin: 'org.graalvm.buildtools.native'

to the subprojects block.