Skip to content

graalvmNative - custom binary - build fails, no classpath, excludeConfig is not passed to Graal command line #478

Description

@vladgon
plugins {
    id 'io.freefair.lombok' version '8.1.0'
    id 'org.springframework.boot' version '3.1.2' apply false
    id 'io.spring.dependency-management' version '1.1.3'
    id 'org.graalvm.buildtools.native' version '0.9.24' apply false
    id 'com.google.protobuf' version "0.9.4" apply false
}
apply plugin: 'org.graalvm.buildtools.native'

springBoot {
    mainClass = 'com.webgrid.web.MyApplication'
}
graalvmNative {
    binaries {
        main {
            jvmArgs.add "-DVERSION=${project.version}"
        }
        qa {
            imageName = 'web-qa'
            mainClass = 'com.webgrid.web.MyApplication'
            jvmArgs.add("-DVERSION=${project.version}-qa")
           // The Classpath should be defaulted to the main binary one, I guess
            classpath.from(aotClasses, configurations.aotCompileClasspath)
            //classpath.from(main.classpath) 
        }
    }
    }
}

The nativeQaCompile task is registered, but classPath is empty, after setting classPath=binaries.main.classPath the native image is building but the exclude from is not passed to the native image compile command, main work fine though

main command
Starting process 'command '/Users/vova/.sdkman/candidates/java/current/bin/native-image''. Working directory
/Users/vova/workspace/java/native/web/build/native/nativeCompile Command: /Users/vova/.sdkman/candidates/java/current/bin/native-image --exclude-config \Q/Users/vova/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport/4.1.94.Final/ec783a737f96991a87b1d5794e2f9eb2024d708a/netty-transport-4.1.94.Final.jar\E ^/META-INF/native-image/.* --exclude-config \Q/Users/vova/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler/4.1.94.Final/cd9121ce24d6d3f2898946d04b0ef3ec548b00b4/netty-handler-4.1.94.Final.jar\E ^/META-INF/native-image/.* --exclude-config \Q/Users/vova/.gradle/caches/modules-2/files-2.1/io.netty/netty-buffer/4.1.94.Final/eec248b26f16e888688e5bb37b7eeda76b78d2f7/netty-buffer-4.1.94.Final.jar\E ^/META-INF/native-image/.* --exclude-config \Q/Users/vova/.gradle/caches/modules-2/files-2.1/io.netty/netty-common/4.1.94.Final/ad4ecf779ebc794cd351f57792f56ea01387b868/netty-common-4.1.94.Final.jar\E ^/META-INF/native-image/.* --exclude-config \Q/Users/vova/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http/4.1.94.Final/9e5404764092c1f6305ad5719078f46ab228d587/netty-codec-http-4.1.94.Final.jar\E ^/META-INF/native-image/.* --exclude-config \Q/Users/vova/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns/4.1.94.Final/25bbe90e10685ce63c32bd0db56574cffffa28de/netty-resolver-dns-4.1.94.Final.jar\E ^/META-INF/native-image/.* --exclude-config \Q/Users/vova/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http2/4.1.94.Final/f651595784d6cca4cbca6a8ad74c48fceed6cea8/netty-codec-http2-4.1.94.Final.jar\E ^/META-INF/native-image/.* -cp /Users/vova/workspace/java/native/web/build/libs/web-1.0-SNAPSHOT-plain.jar
/Users/vova/workspace/java/native/shared/build/libs/shared-1.0-SNAPSHOT-plain.jar
/Users/vova/workspace/java/native/client/build/libs/client-1.0-SNAPSHOT-plain.jar

qa command missing --exclude-config
Starting process 'command '/Users/vova/.sdkman/candidates/java/current/bin/native-image''. Working directory
/Users/vova/workspace/java/native/web/build/native/nativeQaCompile Command: /Users/vova/.sdkman/candidates/java/current/bin/native-image -cp /Users/vova/workspace/java/native/web/build/libs/web-1.0-SNAPSHOT-plain.jar
/Users/vova/workspace/java/native/shared/build/libs/shared-1.0-SNAPSHOT-plain.jar
/Users/vova/workspace/java/native/client/build/libs/client-1.0-SNAPSHOT-plain.jar

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions