Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradle plugin doesn't work in buildSrc #18028

Closed
liuzqt opened this issue Jun 21, 2021 · 5 comments
Closed

gradle plugin doesn't work in buildSrc #18028

liuzqt opened this issue Jun 21, 2021 · 5 comments
Labels
area/gradle Gradle area/kotlin kind/bug Something isn't working

Comments

@liuzqt
Copy link

liuzqt commented Jun 21, 2021

Describe the bug

I have a multi-project gradle layout. And I'm trying to put

plugins {
    id 'io.quarkus'
}

into a plugin defined in buildSrc so as to make it shared among other projects. Got this error:

An exception occurred applying plugin request [id: 'org.tsmap.services']
> Failed to apply plugin 'org.tsmap.services'.
   > Plugin with id 'io.quarkus' not found.

where org.tsmap.services is the plugin I defined in buildSrc and include it in one of my sub-project

In the root dir settings.gradle, I have put:

pluginManagement {
    repositories {
        mavenLocal()
        mavenCentral()
        gradlePluginPortal()
    }
    plugins {
        id "${quarkusPluginId}" version "${quarkusPluginVersion}"
    }
}

so I believe it should be able to locate io.quarkus plugin somewhere in the repositories

Expected behavior

(Describe the expected behavior clearly and concisely.)

Actual behavior

(Describe the actual behavior clearly and concisely.)

To Reproduce

  1. create a quarkus project with gradle build as mentioned here https://quarkus.io/guides/gradle-tooling
  2. put the project into a multi-project gradle layout as sub-project
  3. put id 'io.quarkus' into a plugin defined in buildSrc

Configuration

# Add your application.properties here, if applicable.

Screenshots

Environment (please complete the following information):

Output of uname -a or ver

Darwin 157-48-161-10-in-addr.tusimple.ai 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05)
OpenJDK 64-Bit Server VM GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05, mixed mode, sharing)

GraalVM version (if different from Java)

Quarkus version or git rev

1.13 FINAL

Build tool (ie. output of mvnw --version or gradlew --version)

------------------------------------------------------------
Gradle 7.0.2
------------------------------------------------------------

Build time:   2021-05-14 12:02:31 UTC
Revision:     1ef1b260d39daacbf9357f9d8594a8a743e2152e

Kotlin:       1.4.31
Groovy:       3.0.7
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          11.0.11 (GraalVM Community 11.0.11+8-jvmci-21.1-b05)
OS:           Mac OS X 10.15.6 x86_64

Additional context

(Add any other context about the problem here.)

@liuzqt liuzqt added the kind/bug Something isn't working label Jun 21, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Jun 21, 2021

/cc @evanchooly, @glefloch, @quarkusio/devtools

@glefloch
Copy link
Member

Thanks for reporting this @liuzqt, could you share a simple reproducer ?

@asodja
Copy link
Contributor

asodja commented Jun 25, 2021

In buildSrc you will have to add quarkus plugin in buildSrc/build.gradle(.kts) as:

dependencies {
    implementation("gradle.plugin.io.quarkus:quarkus-gradle-plugin:<plugin-version>")
}

Check:
https://docs.gradle.org/current/samples/sample_convention_plugins.html#things_to_note

Note: I had to apply quarkus-gradle-plugin in my plugin with:

project.apply {
    plugin("io.quarkus")
}

and not with:

plugins {
    id("io.quarkus")
}

So it is applied "lazily", otherwise my build failed. It looks like in quarkus-gradle-plugin some configurations are not lazy and can create some issues when used in combination with some other plugins.

@glefloch
Copy link
Member

@asodja @liuzqt in #20531 we fixed an issue with related to a buildSrc plugins. Reproducers of that issue are working fine.
Could you give a try with the latest quarkus version (2.4.0.Final) ?

@glefloch
Copy link
Member

glefloch commented Feb 8, 2022

I created a simple reproducer and I'm not able to reproduce the error with the latest quarkus version. I'm closing the issue.
@asodja @liuzqt feel free to reopen it if you have a failing reproducer.

@glefloch glefloch closed this as completed Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle area/kotlin kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants