quarkus gradle plugin and enforcedPlatform issue

352 views
Skip to first unread message

Alexey Loubyansky

unread,
May 7, 2019, 1:07:15 PM5/7/19
to Quarkus Development mailing list, and...@gradle.com
(Andres, I'm not sure you are watching this group, hope you don't mind me adding you directly.)

I found that our gradle builds of quickstarts aren't using the correct dependencies (the ones from our BOM). Adding enforcedPlatform like this:

dependencies {
    implementation enforcedPlatform("io.quarkus:quarkus-bom:${quarkusVersion}")
    implementation 'io.quarkus:quarkus-resteasy'
...

Didn't actually work. I realized that if I remove io.quarkus from plugins, e.g.

plugins {
    id 'java'
//    id 'io.quarkus'
}

The dependency resolution starts working as expected, which I verified using `gradle dependencies --configuration compileClasspath`.
However, it's not clear to me what the issue with our plugin is and how it can be fixed. Any suggestion would be appreciated.

Thanks!

Alexey

Alexey Loubyansky

unread,
May 7, 2019, 1:09:00 PM5/7/19
to Quarkus Development mailing list, and...@gradle.com

aalm...@gmail.com

unread,
May 7, 2019, 4:58:48 PM5/7/19
to Quarkus Development mailing list
Hi Alex,

I gave it a try by applying `enforcedPlatform` in the following way

build.gradle
----
plugins {
    id 'java'
    id 'io.quarkus'
}

repositories {
     mavenCentral()
}

dependencies {
    implementation enforcedPlatform("io.quarkus:quarkus-bom:$quarkusVersion")
    implementation 'io.quarkus:quarkus-resteasy'

    testImplementation 'io.quarkus:quarkus-junit5'
    testImplementation 'io.rest-assured:rest-assured'
}
----

And got failures when resolving dependencies as you mentioned. Then noticed that the Gradle wrapper is set to 5.3, AFAIK we had a bug in the enforcedPlatform/platform (https://github.com/gradle/gradle/issues/8845) that was fixed in a later release (5.3.1).
For good measure I upgraded the example to latest (5.4.1) and it works as expected.

As much as possible, try to keep the Gradle version up to date.

Cheers,
Andres

Alexey Loubyansky

unread,
May 8, 2019, 4:25:05 AM5/8/19
to Andres Almiray, Quarkus Development mailing list
Hi Andres,

thanks for looking into this. I guess I'm still missing something. I still get

gradle dependencies --configuration compileClasspath -q

------------------------------------------------------------
Root project
------------------------------------------------------------

compileClasspath - Compile classpath for source set 'main'.
+--- io.quarkus:quarkus-bom:999-SNAPSHOT
\--- io.quarkus:quarkus-resteasy FAILED

gradle -v

------------------------------------------------------------
Gradle 5.4.1
------------------------------------------------------------

Build time:   2019-04-26 08:14:42 UTC
Revision:     261d171646b36a6a28d5a19a69676cd098a4c19d

Kotlin:       1.3.21
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          1.8.0_201 (Oracle Corporation 25.201-b09)
OS:           Linux 5.0.4-200.fc29.x86_64 amd64

Thanks,
Alexey

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
Visit this group at https://groups.google.com/group/quarkus-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/4e592ad9-522b-48aa-9cd3-c945b893f0bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexey Loubyansky

unread,
May 8, 2019, 4:33:04 AM5/8/19
to Andres Almiray, Quarkus Development mailing list
Ah, here is what appears to make a difference. If I use `quarkusVersion = 0.14.0` it works, but if I use `quarkusVersion = 999-SNAPSHOT` which is present only in my local repo then it fails. I did add mavenLocal()

repositories {
     mavenLocal()
     mavenCentral()
}

Thanks,
Alexey

Andres Almiray

unread,
May 8, 2019, 4:36:49 AM5/8/19
to Alexey Loubyansky, Quarkus Development mailing list
Ah yes, I removed the definition to mavenLocal() on the snippet I posted as I wanted to try it with release only versions. 

For dealing with snapshots as you just tried you will still need mavenLocal() on both settings.gradle (to resolve the plugin) and in build.gradle (to resolve BOM dependencies)

Cheers
Andres

Sent from my primitive tricorder

Alexey Loubyansky

unread,
May 8, 2019, 5:04:22 AM5/8/19
to Andres Almiray, Quarkus Development mailing list
I do actually have it in both scripts. Still fails on io.quarkus:quarkus-resteasy.

// settings.gradle
pluginManagement {
    repositories {
        mavenLocal()
        mavenCentral()
        gradlePluginPortal()
    }

    resolutionStrategy {
        eachPlugin {
            if (requested.id.id == 'io.quarkus') {
                useModule("io.quarkus:quarkus-gradle-plugin:${quarkusVersion}")
            }
        }
    }
}

// build.gradle
plugins {
    id 'java'
    id 'io.quarkus'
}

repositories {
     mavenLocal()
     mavenCentral()
}

dependencies {
    implementation enforcedPlatform("io.quarkus:quarkus-bom:${quarkusVersion}")
    implementation 'io.quarkus:quarkus-resteasy'

    testCompile 'io.quarkus:quarkus-junit5'
    testCompile 'io.rest-assured:rest-assured'
}

Thanks,
Alexey

Andres Almiray

unread,
May 8, 2019, 5:07:42 AM5/8/19
to Quarkus Development mailing list
OK, just to make sure I got right so that we can narrow the issue down: it works with 0.14.0 one the build has been updated to Gradle 5.4.1, but it fails with 999-SNAPSHOT.

I'll give it a try with latest 999-SNAPSHOT and report back.

Cheers,
Andres
To unsubscribe from this group and stop receiving emails from it, send an email to quark...@googlegroups.com.

Andres Almiray

unread,
May 8, 2019, 6:11:14 AM5/8/19
to Quarkus Development mailing list
Alright, I've narrowed it down to the following:

 quarkus-gradle-plugin 0.14.0 + quarkus 0.14.0 + Gradle 5.4.1 => works
 quarkus-gradle-plugin 0.14.0 + quarkus 999-SNAPSHOT + Gradle 5.4.1 => works
 quarkus-gradle-plugin 999-SNAPSHOT + quarkus 999-SNAPSHOT + Gradle 5.4.1 => breaks

Perhaps if we trace changes made to the quarkus gradle plugin between 0.14.0 and a540c38 we can find the cause.

Cheers,
Andres

Alexey Loubyansky

unread,
May 8, 2019, 7:43:05 AM5/8/19
to Andres Almiray, Quarkus Development mailing list
Right, I have the same outcome for the combinations you listed. However, it doesn't look like it was a change in the plugin that breaks it. I just replaced current plugin sources with the ones from 0.14.0 release (did add some methods to one class implementing an interface but that shouldn't relevant), rebuilt and still see the same failure. I am executing `./gradlew dependencies --configuration compileClasspath -q` It doesn't seem like an implementation detail of a plugin should break that?

To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.

Andres Almiray

unread,
May 8, 2019, 8:41:43 AM5/8/19
to Quarkus Development mailing list
I see, I got the same results. changes made to the quarkus gradle plugin are minimal and I agree that they should not interfere nor appear to the cause of what we're observing.

I did another check with the following

 - quarkus gradle plugin 999-SNAPSHOT (a540c38) + quarkus 0.14.0 => works
 - quarkus gradle plugin 999-SNAPSHOT (patched) + quarkus 0.14.0 => works

This made me look into the differences of quarkus-bom between 0.14.0 and 999-SNAPSHOT ad found the following

23c23
<         <version>0.14.0</version>
---
>         <version>999-SNAPSHOT</version>
33c33
<         <resteasy.version>4.0.0.CR2</resteasy.version>
---
>         <resteasy.version>4.0.0.Final</resteasy.version>
50c50
<         <smallrye-open-api.version>1.1.1</smallrye-open-api.version>
---
>         <smallrye-open-api.version>1.1.3</smallrye-open-api.version>
83c83
<         <graal-sdk.version>1.0.0-rc15</graal-sdk.version>
---
>         <graal-sdk.version>1.0.0-rc16</graal-sdk.version>
88a89
>         <commons-codec.version>1.11</commons-codec.version>
93a95
>         <hibernate-search.version>6.0.0.Alpha5</hibernate-search.version>
98a101
>         <elasticsearch-rest-client.version>7.0.0</elasticsearch-rest-client.version>
108c111
<         <wildfly-elytron.version>2.0.0.Alpha1</wildfly-elytron.version>
---
>         <wildfly-elytron.version>2.0.0.Alpha4</wildfly-elytron.version>
110c113
<         <jboss-threads.version>3.0.0.Alpha4</jboss-threads.version>
---
>         <jboss-threads.version>3.0.0.Beta3</jboss-threads.version>
125a129
>         <json-smart.version>2.3</json-smart.version>
132a137
>         <reactive-pg-client.version>0.11.2</reactive-pg-client.version>
139a145
>         <aws-lambda-serverless-java-container.version>1.3.1</aws-lambda-serverless-java-container.version>
254a261,265
>                 <artifactId>quarkus-elasticsearch-rest-client</artifactId>
>                 <version>${project.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>io.quarkus</groupId>
261a273,287
>              </dependency>
>             <dependency>
>                 <groupId>io.quarkus</groupId>
>                 <artifactId>quarkus-hibernate-orm</artifactId>
>                 <version>${project.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>io.quarkus</groupId>
>                 <artifactId>quarkus-hibernate-orm-panache</artifactId>
>                 <version>${project.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>${project.groupId}</groupId>
>                 <artifactId>quarkus-hibernate-search-elasticsearch</artifactId>
>                 <version>${project.version}</version>
360c386
<                 <artifactId>quarkus-jaxrs-json</artifactId>
---
>                 <artifactId>quarkus-resteasy-server-common</artifactId>
365c391
<                 <artifactId>quarkus-narayana-jta</artifactId>
---
>                 <artifactId>quarkus-jaxrs-json</artifactId>
370c396
<                 <artifactId>quarkus-undertow</artifactId>
---
>                 <artifactId>quarkus-narayana-jta</artifactId>
375c401
<                 <artifactId>quarkus-hibernate-orm</artifactId>
---
>                 <artifactId>quarkus-undertow</artifactId>
395c421
<                 <artifactId>quarkus-hibernate-orm-panache</artifactId>
---
>                 <artifactId>quarkus-reactive-pg-client</artifactId>
429a456,460
>                 <artifactId>quarkus-amazon-lambda-resteasy</artifactId>
>                 <version>${project.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>io.quarkus</groupId>
588a620,624
>                 <groupId>commons-codec</groupId>
>                 <artifactId>commons-codec</artifactId>
>                 <version>${commons-codec.version}</version>
>             </dependency>
>             <dependency>
1061a1098,1102
>                 <groupId>net.minidev</groupId>
>                 <artifactId>json-smart</artifactId>
>                 <version>${json-smart.version}</version>
>             </dependency>
>             <dependency>
1383a1425,1429
>                 <artifactId>wildfly-elytron-password-impl</artifactId>
>                 <version>${wildfly-elytron.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.wildfly.security</groupId>
1443a1490,1506
>                 <groupId>org.hibernate.search</groupId>
>                 <artifactId>hibernate-search-backend-elasticsearch</artifactId>
>                 <version>${hibernate-search.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.hibernate.search</groupId>
>                 <artifactId>hibernate-search-mapper-orm</artifactId>
>                 <version>${hibernate-search.version}</version>
>                 <exclusions>
>                     <!-- the right version will come with Hibernate ORM -->
>                     <exclusion>
>                         <groupId>org.hibernate.common</groupId>
>                         <artifactId>hibernate-commons-annotations</artifactId>
>                     </exclusion>
>                 </exclusions>
>             </dependency>
>             <dependency>
1463a1527,1536
>                 <groupId>org.elasticsearch.client</groupId>
>                 <artifactId>elasticsearch-rest-client</artifactId>
>                 <version>${elasticsearch-rest-client.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.elasticsearch.client</groupId>
>                 <artifactId>elasticsearch-rest-client-sniffer</artifactId>
>                 <version>${elasticsearch-rest-client.version}</version>
>             </dependency>
>             <dependency>
1508a1582,1591
>                 <groupId>io.reactiverse</groupId>
>                 <artifactId>reactive-pg-client</artifactId>
>                 <version>${reactive-pg-client.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>io.smallrye.reactive</groupId>
>                 <artifactId>smallrye-axle-postgres-client</artifactId>
>                 <version>${axle-client.version}</version>
>             </dependency>
>             <dependency>
1684a1768,1772
>             <dependency>
>                 <groupId>com.amazonaws.serverless</groupId>
>                 <artifactId>aws-serverless-java-container-core</artifactId>
>                 <version>${aws-lambda-serverless-java-container.version}</version>
>             </dependency>

So we have:

 - updated values for some existing properties
 - new properties
 - new dependencies

Nothing surprising that would pop out immediately.
I'll keep digging.

Cheers,
Andres

Alexey Loubyansky

unread,
May 13, 2019, 12:09:23 PM5/13/19
to Andres Almiray, Quarkus Development mailing list
Hi Andres, just fyi, I narrowed down the issue to avoid quarkus stuff. The reproducer is here https://github.com/aloubyansky/playground/commits/gradle-plugin-bom


To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.

Alexey Loubyansky

unread,
May 13, 2019, 12:12:56 PM5/13/19
to Andres Almiray, Quarkus Development mailing list
It appears if I comment out enforcePlatform from the plugin itself, it works.

Andres Almiray

unread,
May 13, 2019, 12:53:16 PM5/13/19
to Quarkus Development mailing list
Hi Alexey,

Thank you, this helps a lot. I can reproduce the error as well.
A temporary workaround would be to use the buildscript block instead of the plugins block for this locally published plugin, such as

buildscript {
    repositories {
        mavenLocal()
    }
    dependencies {
        classpath 'io.playground:playground-gradle-plugin:999-SNAPSHOT'
    }
}

plugins {
    id 'java'
}

apply plugin: 'io.playground'


I'm looking at options to make the 'plugins' block in local development mode.

Cheers,
Andres

Alexey Loubyansky

unread,
May 14, 2019, 3:37:38 AM5/14/19
to Andres Almiray, Quarkus Development mailing list
Hi Andres,

thanks a lot! The trick does work for Quarkus as well. I am going to apply this to our quickstarts as well, as it appears to work for both released and deployed Quarkus versions and a local snapshot.

Please let us know when there is a proper/recommended alternative we should use instead.

Thanks!

Alexey

To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.

Andres Almiray

unread,
May 15, 2019, 4:42:28 PM5/15/19
to Quarkus Development mailing list
Hi Alexey,

It seems there's indeed a problem on the Gradle side when resolving BOMs if the plugins block is used to resolve locally published plugins due to handling of the plugin's metadata (hence why the buildscript block works which bypasses that mechanism).
Could you open a ticket at https://github.com/gradle/gradle/issues? It'd be great if you can add a link to the playground project. Thanks!

Cheers,
Andres

Alexey Loubyansky

unread,
May 16, 2019, 4:12:40 AM5/16/19
to Andres Almiray, Quarkus Development mailing list
Hi Andres,


Thanks!

Alexey

To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages