In order to convert a project to native-image I try to add the plugin “org.graalvm.buildtools.native”. I specify that my pc is offline this is important, for various reasons I am obliged to use graalVM on an offline installation.
To be able to run my basic project I had to already compile it on an online installation, then I transferred the contents of the .gradle to this offline installation.
After a compilation on the offline installation the project run, the problem is not here.
To be able to install the plugin “org.graalvm.buildtools.native” I used this documentation:
https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html
Which gives me the following build.gradle:
plugins {
id 'org.graalvm.buildtools.native' version '0.9.28'
id 'maven-publish'
id 'app-sonar'
}
allprojects {
group = 'app.project'
}
wrapper {
gradleVersion = '8.7'
distributionUrl = "gradle-${gradleVersion}-bin.zip"
}
On an online computer I can compile the project again and download the plugin into my .gradle folder.
However, when I retransfer my .gradle from my online installation to my offline installation, the compilation does not work because it cannot find this plugin.
I got this error :
Executing 'clean build --offline'...
> Task :buildSrc:extractPluginRequests UP-TO-DATE
> Task :buildSrc:generatePluginAdapters UP-TO-DATE
> Task :buildSrc:compileJava UP-TO-DATE
> Task :buildSrc:compileGroovy NO-SOURCE
> Task :buildSrc:compileGroovyPlugins UP-TO-DATE
> Task :buildSrc:pluginDescriptors UP-TO-DATE
> Task :buildSrc:processResources UP-TO-DATE
> Task :buildSrc:classes UP-TO-DATE
> Task :buildSrc:jar UP-TO-DATE
FAILURE: Build failed with an exception.
* Where:
Build file 'C:UsersLenovo02DocumentsWorkplaceJavaAppbuild.gradle' line: 2
* What went wrong:
Plugin [id: 'org.graalvm.buildtools.native', version: '0.9.28'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (No included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin:0.9.28')
Searched in the following repositories:
MavenLocal(file:/C:/Users/Lenovo02/.m2/repository/)
maven(appartifactory/public_maven)
maven2(appartifactory/public_maven2)
maven3(appartifactory/public_maven3)
I tried to listen some advice here and there like downloading version 0.9.28 of org.graalvm.buildtools:native.maven.plugin or following the solution on this forum:
Is it possible to Install file to local cache in gradle similar to Maven install:install-file?
Which gave me a new build.gradle :
plugins {
id 'org.graalvm.buildtools.native' version '0.9.28'
id 'maven-publish'
id 'app-sonar'
}
allprojects {
group = 'app.project'
}
wrapper {
gradleVersion = '8.7'
distributionUrl = "gradle-${gradleVersion}-bin.zip"
}
configurations{
resultArchives
}
uploadResultArchives{
repositories {
mavenDeployer {
repository(url: mavenLocal().url)
pom.version = '0.9.28'
pom.artifactId= 'native-image-plugin'
pom.groupId= 'org.graalvm.buildtools'
}
}
}
artifacts {
resultArchives file: file('C:\Users\Lenovo02\.gradle\caches\modules-2\files-2.1\org.graalvm.buildtools.native\org.graalvm.buildtools.native.gradle.plugin\0.9.28\5046f95768b90b1b61b9daf9537503129850fc30\org.graalvm.buildtools.native.gradle.plugin-0.9.28.pom')
}
Which gave me the same error.