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.

Does this plugin work with Gradle Plugin DSL?

See original GitHub issue

I’m trying to enable it like this in my root build.gradle file:

plugins {

    id "de.mannodermaus.android-junit5" version "1.4.2.0"
}

In my settings.gradle I have the following:

pluginManagement {

    repositories {

        google()
        mavenCentral()
        gradlePluginPortal()
    }
}

However whenever I try to sync I receive the following error:

Plugin [id: ‘de.mannodermaus.android-junit5’, version: ‘1.4.2.0’] was not found in any of the following sources:

  • Gradle Core Plugins (plugin is not in ‘org.gradle’ namespace)
  • Plugin Repositories (could not resolve plugin artifact ‘de.mannodermaus.android-junit5:de.mannodermaus.android-junit5.gradle.plugin:1.4.2.0’) Searched in the following repositories: Google MavenRepo Gradle Central Plugin Repository

So, can I use it together with new Plugins DSL?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mannodermauscommented, Apr 26, 2019

This plugin doesn’t expose the necessary plugin marker artifact required by the Plugins DSL. You’d need a custom resolution strategy to map to the correct coordinates in your pluginManagement block:

pluginManagement {
    repositories {
        mavenCentral()
    }
    resolutionStrategy {
        eachPlugin {
            if (requested.id.id == "de.mannodermaus.android-junit5") {
                useModule("de.mannodermaus.gradle.plugins:android-junit5:$requested.version")
            }
        }
    }
}

The Android Gradle Plugin also doesn’t support the Plugins DSL, as far as I’m aware. Do you resolve that plugin similarly?

1reaction
mannodermauscommented, Apr 26, 2019

I quickly verified @autonomousapps’ statement and this actually works as well, although you need to strip away the version off the line inside the plugins block.

@Lingviston, as an alternative to the workaround mentioned above, this works as well:

// Project-level build.gradle:
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "de.mannodermaus.gradle.plugins:android-junit5:1.4.2.0"
    }
}

// Module-level build.gradle:
plugins {
    id "de.mannodermaus.android-junit5"
}

Either of these approaches should work fine for your use case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Gradle Plugins
The plugins DSL provides a succinct and convenient way to declare plugin dependencies. It works with the Gradle plugin portal to provide easy...
Read more >
What the difference in applying gradle plugin - Stack Overflow
plugins works in multi-project, according to Gradle tutorial (Gradle version 5.6.2) guides.gradle.org/creating-multi-project-builds/… It uses ...
Read more >
Chapter 21. Gradle Plugins
The new plugins DSL provides a more succinct and convenient way to declare plugin dependencies. It works with the new Gradle plugin portal...
Read more >
Introduction to writing Gradle plugins - Tom Gregory
1) Expose one or more tasks to allow you to run some specific action · 2) Perform some behaviour automatically when the plugin...
Read more >
5. Add Gradle Plugin with Dependencies - Spring Cloud
Plugin DSL GA versions. // build.gradle plugins { id "groovy" // this will work only for GA versions of Spring Cloud Contract id...
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