question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gradle plugin does not work with Kotlin DSL

See original GitHub issue

Having build.gradle.kts like

plugins {
    id("au.com.dius.pact") version "3.6.2"
}

pact {
    publish {
        pactBrokerUrl = "http://localhost:80"
    }
}

causes an error:

Script compilation errors:

  Line 70:     publish {
                       ^ Type mismatch: inferred type is () -> TypeVariable(_L) but Closure<(raw) Any!>! was expected

  Line 71:         pactBrokerUrl = "http://localhost:80"
                   ^ Unresolved reference: pactBrokerUrl

2 errors

I guess PactPluginExtension should use org.gradle.api.Action instead of Groovy Closure.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
pkubowiczcommented, Oct 20, 2019

I had problems writing an automated test with Kotlin DSL, so I tested this with a standalone project:

plugins {
    id("au.com.dius.pact") version "4.0.2"
}

pact {
    publish {
        pactBrokerUrl = "http://localhost:80"
    }
    reports {
        defaultReports()
    }
    serviceProviders {
        create("provider1") {
            protocol = "http"
        }
    }
}
0reactions
pkubowiczcommented, Oct 19, 2019

I have a working prototype, I will submit a pull request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gradle Kotlin DSL Primer
Troubleshooting. The IDE support is provided by two components: The Kotlin Plugin used by IntelliJ IDEA/Android Studio.
Read more >
Gradle kotlin-dsl configuration not working, android extension ...
5 Answers 5 · Find gradlew in your project root folder. · Right click on it, then open in -> terminal. · Write...
Read more >
Plugin is not applied when using Gradle Kotlin DSL ... - GitHub
I'm afraid new plugins gradle block is not working with this plugin, since kotlinx-serialization for gradle is not uploaded to Gradle Plugin ......
Read more >
Gradle Kotlin DSL - Code Reuse - Eugene Petrenko
With Gradle Kotlin DSL, it does not work that easily. I've been looking for the solution to this problem in Gradle Kotlin DSL...
Read more >
Kotlin DSL: Gradle scripts in Android made easy - Medium
In this article, we will convert some common Groovy-based Gradle scripts into Kotlin DSL scripts. Let's get started. Open half baked side android...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found