This message was deleted.
# community-support
s
This message was deleted.
n
Please don't cross-post and keep your messages in a single thread, so all information is grouped together.
r
ok
n
As to your question: given that the gradle version you're using is ancient, most likely the palantir docker plugin just doesn't support that version anymore. Also note that the plugin itself doesn't seem to be actively supported anymore: https://github.com/palantir/gradle-docker
r
let me delete from one post
i have deleted from plugins-development channel
thank you 2
n
My first suggestion would be to attempt to upgrade to a more recent version of gradle. Besides that, running your build with
--stacktrace
might give more details on the actual error.
r
i can understands that palantir docker plugin does' not support it ..but your requirement to run in that version only
n
well, try an older version of the plugin?
r
i will check with stackstrace but ....if i used gradle version 4.5 or 7.4...getting same error
got error
Copy code
root@Testing:~/PostmanCollectionToOAS# ./gradlew buildDockerLatest --stacktrace

FAILURE: Build failed with an exception.

* Where:
Build file '/root/PostmanCollectionToOAS/build.gradle' line: 35

* What went wrong:
A problem occurred evaluating root project 'PostmanCollectionToOAS'.
> com.palantir.gradle.docker.DockerExtension_Decorated cannot be cast to java.lang.Class

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'PostmanCollectionToOAS'.
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:204)
        at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.ClassCastException: com.palantir.gradle.docker.DockerExtension_Decorated cannot be cast to java.lang.Class
        at org.gradle.api.internal.project.taskfactory.TaskFactory.createTask(TaskFactory.java:73)
im thinking in build.gradle something im missing which i cannot understand
n
Copy code
* Where:
Build file '/root/PostmanCollectionToOAS/build.gradle' line: 35
It mentions a specific line, so that might help you debug the problem?
r
if i check line number 35 it show this one :- classpath "com.palantir.gradle.dockergradle docker0.34.0"
n
task buildDockerLatest(type: docker)
<-- I think you have the type wrong here. You're trying to use the plugin's extension as the type for your task. The plugin itself uses the
Exec
task type in order to create docker images: https://github.com/palantir/gradle-docker/blob/0.34.0/src/main/groovy/com/palantir/gradle/docker/PalantirDockerPlugin.groovy#L69-L73
you should probably read the plugin's readme (and especially go through the examples): https://github.com/palantir/gradle-docker/tree/0.34.0
r
let me check
i read this docs link
v
This is what I use to build docker images: https://plugins.gradle.org/plugin/com.bmuschko.docker-remote-api 🙂
âž• 1
r
let me check
got error after i execute :- ./gradlew buildDockerLatest
Copy code
FAILURE: Build failed with an exception.

* Where:
Build file '/home/osboxes/testing/build.gradle' line: 29

* What went wrong:
A problem occurred evaluating root project 'testing'.
> Could not set unknown property 'plugin' for root project 'testing' of type org.gradle.api.Project.
and my build.gradle
Copy code
buildscript {
  repositories {
    maven {
      url = uri("<https://plugins.gradle.org/m2/>")
    }
  }
  dependencies {
    classpath("com.bmuschko:gradle-docker-plugin:9.3.3")
  }
}

apply(plugin = "com.bmuschko.docker-remote-api")
//apply plugin: 'docker'

task buildDockerLatest(type: docker) {
    push = false
    tag = 'abc/demo'
    tagVersion = "latest"
    dockerfile = file('Dockerfile')
    doFirst {
        copy {
            from '.'
            into 'build/docker'
            exclude "gradle"
            exclude "gradlew"
            exclude "gradlew.bat"
            exclude "build"
            exclude "build.gradle"
            exclude "Dockerfile"
        }
    }
}

task wrapper (type:Wrapper) {
    gradleVersion = '4.5' //we want gradle 2.10 to run this project
}
v
Don't use Kotlin DSL syntax in a Groovy DSL file. Actually, I strongly suggest using Kotlin DSL anyway. You immediately get type-safe build scripts, much better error messages when you mess up the syntax in many cases, and amazingly better IDE support if you use a decent IDE like IntelliJ IDEA. Also you should not use the legacy
apply(...)
anyway, but use the
plugins { ... }
block to apply plugins in almost all cases.
And you should really update that ancient Gradle version you are using 🙂
r
i use visual studio code
v
Well, that's not really an IDE, but a fancy text editor. 🙂
r
actually my company use gradle 4.5 i know its older version but its support to your application
ok let me install IntelliJ IDEA
so that why i have to use gradle 4.5
v
I did not understand the "why"
Btw: https://bmuschko.github.io/gradle-docker-plugin/current/user-guide/
This plugin requires Gradle >= 7.4.0 to work properly.
r
its not in my hand i have follow procedure of what company said
then i have to use palantir.gradle
when i execute this command ./gradlew buildDockerLatest it automatically start downloading gradle 4.5
we already using palantir.gradle to build docker image and its working in other application
v
If your company forces you to use an ancient version of a build tool that then also forces you to use ancient versions of plugins that are still compatible or abandoned plugins that are unmaintained, they should really reconsider their policies. Alone the developer and CI time they waste in only allowing that ancient Gradle version is enormous and costs them muuuch money.
But well, if it works for you, great 🙂 Just mentioned that bmuschko's plugin works much better for me. 🙂
r
no we use gradle past 4 years has developer has to work on supporting gradle latest version in code
v
I did not get that sentence. But anyway, if you are bound to that Gradle version, you can maybe go back in history to find a vesrion of bmuschko's plugin that was compatible with it, or you can continue using palatir, whatever suits you best. 🙂
r
ok
v
Niels most probably already told you what the actual problem was 🙂
r
yeah
Hi, I made changes in build.gradle file as got help from developer but when i execute gradle i got below error Error
Copy code
./gradlew docker
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':docker'.
> A problem occurred starting process 'command 'docker''
here is new build.gradle file
Copy code
buildscript {
    // ext {
    //     springBootVersion = SPRING_BOOT_VERSION
    //}
    repositories {
        mavenCentral()
        maven {
            url "<https://plugins.gradle.org/m2/>"
//            url '<https://repo.spring.io/libs-milestone>'
        }
    }
    dependencies {
        // classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        //       classpath('se.transmode.gradle:gradle-docker:1.2')
        classpath "com.palantir.gradle.docker:gradle-docker:0.34.0"
    }
}
apply plugin: 'com.palantir.docker'
//apply plugin: 'docker'

//tasks.named("dockerPrepare").configure { dependsOn("bootJar") }

    docker {

//        tasks.docker.dependsOn('build')
        name "abc/test:latest"
        files '*'
        dockerfile file('Dockerfile')
        tag 'DockerHub', "abc/tesing:${getNightly()}"
    }

task wrapper (type:Wrapper) {
    gradleVersion = '4.5' //we want gradle 2.10 to run this project
}
v
That's not a Gradle question, but a question for the Palantir plugin actually. It tries to invoke the command
docker
and expectes that you have it in your
PATH
which you do not.