Upgrading Gradle Quarkus Plugin to 2.10.0.Final - gradle

trying to upgrade Gradle's Quarkus Plugin to 2.10.0.Final. Running
./gradlew build -x test
leads to
An exception occurred applying plugin request [id: 'io.quarkus', version: '2.10.0.Final']
> Failed to apply plugin 'io.quarkus'.
> class org.gradle.api.internal.provider.DefaultProvider cannot be cast to class org.gradle.api.internal.provider.CollectionProviderInternal (org.gradle.api.internal.provider.DefaultProvider and org.gradle.api.internal.provider.CollectionProviderInternal are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader #685cb137)
Above Exception gives me the impression, that gradle can't find version 2.10.0.Final of the plugin, which is counter-intuitive for me ... it is available online https://plugins.gradle.org/plugin/io.quarkus.
For reference:
gradle.properties
quarkusPluginVersion=2.10.0.Final
quarkusPlatformArtifactId=quarkus-bom
quarkusPluginId=io.quarkus
quarkusPlatformGroupId=io.quarkus.platform
quarkusPlatformVersion=2.10.0.Final
settings.gradle
pluginManagement {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
plugins {
id "${quarkusPluginId}" version "${quarkusPluginVersion}"
}
}
EDIT
$ ./gradlew --version
------------------------------------------------------------
Gradle 7.3.3
------------------------------------------------------------
Build time: 2021-12-22 12:37:54 UTC
Revision: 6f556c80f945dc54b50e0be633da6c62dbe8dc71
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.15 (Azul Systems, Inc. 11.0.15+10-LTS)
OS: Mac OS X 12.1 x86_64

Related

IDEA reports errors for ShadowJar task in build.gradle.kts, while ./gradlew run works

I am using Kotlin DSL for gradle config.
./gradlew works fine, but IDEA still reports errors for ShadowJar in build.gradle.kts
Type argument is not within its bounds.
Expected:Task!
Found: ShadowJar
QUESTION:
Is there any alternative syntax for ShadowJar task that is OK for both gradle and IDEA?
git repo to reproduce the issue:
https://github.com/ludenus/gradle-kts-shadow-jar
build.gradle.kts:
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
kotlin("jvm") version "1.3.20"
id("com.github.johnrengelman.shadow") version "4.0.4"
application
}
group = "com.example"
version = "0.0.1"
repositories {
jcenter()
mavenCentral()
}
val junitVersion = "5.4.0"
dependencies {
implementation(kotlin("stdlib", "1.3.20"))
implementation("org.jetbrains.kotlin:kotlin-reflect:1.3.20")
compileClasspath("com.github.jengelman.gradle.plugins:shadow:4.0.4")
implementation("org.slf4j:slf4j-api:1.7.21")
implementation("ch.qos.logback:logback-core:1.2.3")
implementation("ch.qos.logback:logback-classic:1.2.3")
testImplementation("io.kotlintest:kotlintest-runner-junit5:3.3.1")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testImplementation("org.junit.jupiter:junit-jupiter-params:$junitVersion")
runtime("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
}
application {
mainClassName = "com.example.App"
}
val test by tasks.getting(Test::class) {
useJUnitPlatform()
testLogging.showStandardStreams = true
testLogging.events = setOf(TestLogEvent.PASSED, TestLogEvent.FAILED, TestLogEvent.SKIPPED, TestLogEvent.STANDARD_OUT, TestLogEvent.STANDARD_ERROR)
}
tasks.withType<ShadowJar> {
manifest {
attributes["Implementation-Title"] = "Shadow Jar"
attributes["Implementation-Version"] = version
attributes["Main-Class"] = "com.example.App"
}
classifier = "jar-with-dependencies"
}
VERSIONS:
Gradle:
$ ./gradlew --version
------------------------------------------------------------
Gradle 5.2.1
------------------------------------------------------------
Build time: 2019-02-08 19:00:10 UTC
Revision: f02764e074c32ee8851a4e1877dd1fea8ffb7183
Kotlin DSL: 1.1.3
Kotlin: 1.3.20
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 4.15.0-46-generic amd64
IDEA:
IntelliJ IDEA 2019.1 (Community Edition)
Build #IC-191.6183.87, built on March 27, 2019
JRE: 1.8.0_202-release-1483-b39 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-46-generic
IDEA is configured to use gradle 'wrapper' task configuration.
OS
$ uname -a
Linux qa-pc 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
compileClasspath is most likely confusing idea-gradle integration

Gradle: Could not get unknown property 'classesDir' for main classes

According to the documentation, I've tried to use aspectj plugin.
This is the message I get when I build my project.
FAILURE: Build failed with an exception.
* Where:
Build file '/home/jesudi/projects/gradle-vscode/build.gradle' line: 22
* What went wrong:
A problem occurred evaluating root project 'security'.
> Failed to apply plugin [id 'aspectj.gradle']
> Could not create task ':compileAspect'.
> Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.
This is my script:
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.apache.meecrowave:meecrowave-gradle-plugin:1.2.6"
classpath "gradle.plugin.aspectj:gradle-aspectj:0.1.6"
}
}
plugins {
id 'java'
}
project.ext {
aspectjVersion = '1.9.2'
}
apply plugin: 'aspectj.gradle'
apply plugin: "org.apache.microwave.microwave"
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
dependencies {
compile("org.apache.meecrowave:meecrowave-core:1.2.6")
compile("org.apache.meecrowave:meecrowave-specs-api:1.2.6")
}
meecrowave {
httpPort = 9090
// most of the meecrowave core configuration
}
This is the gradle -version output:
------------------------------------------------------------
Gradle 5.1.1
------------------------------------------------------------
Build time: 2019-01-10 23:05:02 UTC
Revision: 3c9abb645fb83932c44e8610642393ad62116807
Kotlin DSL: 1.1.1
Kotlin: 1.3.11
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 11.0.2 (Oracle Corporation 11.0.2+9)
OS: Linux 4.15.0-20-generic amd64
In Gradle 5.x, this property has been renamed to classesDirs from classesDir.
You can find more information here
Possible your plugin is not a root of problem but the version of Gradle is.
First time I had the same error in libgdx game (android studio).
In build.gradle(desktop) file "classDir was renamed to classesDirs and it helped.
from files(sourceSets.main.output.classesDirs)
The classesDir property was deprecated in gradle 4.x, and removed in gradle 5.x (see the release notes).
The plugin has apparently not been maintained.
I got a similar error message, not with this plugin but even with the HelloWorld app created by Grails (3.2.9). In my case, I already used sdkman to set my current Gradle to 3.5 instead of 5, but the problem persists. It turned out that the "grails" cli (https://github.com/grails/grails-core/blob/3.2.x/grails-shell/src/main/groovy/org/grails/cli/gradle/GradleUtil.groovy) uses the default sdkman version for Gradle (which is different from the "current" version).
From Grails 3.3.X, one can set "gradleWrapperVersion=3.5" in gradle.properties instead, or use GRAILS_GRADLE_HOME environment variable as before.

Gradle can't resolve 'kotlin' plugin. Am I missing the correct maven repository?

gradle tasks fails telling me it can't find the plugin 'kotlin'. My build.gradle file starts with:
buildscript {
ext.kotlin_version = '1.3.11'
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url "https://dl.bintray.com/kotlin/kotlin-dev/" }
maven { url "http://central.maven.org/maven2/" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id 'kotlin'
id 'application'
}
WRT maven repositories, I'm clearly just trying to redundantly add all the kitchen sinks I can find. I have tried none, and commenting out some. Which one am I missing?
From the log:
12:55:04.419 [DEBUG] [org.gradle.launcher.daemon.server.exec.ReturnResult] Daemon is dispatching the build result: Failure[value=org.gradle.initialization.Repor
tedException: org.gradle.internal.exceptions.LocationAwareException: Build file '/home/_/workspace/_/build.gradle' line: 18
Plugin [id: 'kotlin'] was not found in any of the following sources:
- Gradle Core Plugins (not a core plugin, please see https://docs.gradle.org/5.0/userguide/standard_plugins.html for available core plugins)
- Plugin Repositories (plugin dependency must include a version number for this source)]
I have also tried version 1.3.10 because it matches what's listed in gradle version info:
------------------------------------------------------------
Gradle 5.0
------------------------------------------------------------
Build time: 2018-11-26 11:48:43 UTC
Revision: 7fc6e5abf2fc5fe0824aec8a0f5462664dbcd987
Kotlin DSL: 1.0.4
Kotlin: 1.3.10
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 1.8.0_181 (Oracle Corporation 25.181-b13)
OS: Linux 4.19.6-200.fc28.x86_64 amd64
Kotlin is not a core plugin, therefore you have to include the version. Also the name is different, when using the plugins configuration:
plugins {
id "org.jetbrains.kotlin.jvm" version "1.3.11"
}
If you use the apply function, you could still use the simple name:
apply plugin: "kotlin"
You'll find this information on Targeting the JVM.

Error compiling Ceylon example with Gradle

Ceylon 1.3.1 has just been released, one of the new items is better integration with Java projects/libraries. Decided to take one of the samples for a spin (https://github.com/DiegoCoronel/ceylon-spring-boot) alongside the ceylon-gradle plugin (https://github.com/renatoathaydes/ceylon-gradle-plugin).
As far as I can tell, turning this project into a multi-project Gradle build is a matter of adding two files with the following configuration.
settings.gradle
include 'gateway'
include 'discovery'
include 'foo'
include 'bar'
include 'foobar'
build.gradle
plugins {
id 'com.athaydes.ceylon' version '1.3.0' apply false
}
subprojects { subprj ->
subprj.apply plugin: 'com.athaydes.ceylon'
repositories {
mavenCentral()
}
ceylon {
module = subprj.name
}
}
Unfortunately building any of the modules results in errors, such as
$ gradle :gateway:compileCeylon
:gateway:resolveCeylonDependencies
:gateway:createDependenciesPoms
:gateway:createMavenRepo
:gateway:generateOverridesFile
:gateway:createModuleDescriptors
:gateway:importJars
:gateway:compileCeylon
source/gateway/module.ceylon:3: error: Pre-resolving of module failed: Could not find module: antlr/2.7.7
import ceylon.interop.java "1.3.0";
^
ceylon compile: There was 1 error
:gateway:compileCeylon FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':gateway:compileCeylon'.
> Ceylon process exited with code 1. See output for details.
This happens using Gradle 3.2
------------------------------------------------------------
Gradle 3.2
------------------------------------------------------------
Build time: 2016-11-14 12:32:59 UTC
Revision: 5d11ba7bc3d79aa2fbe7c30a022766f4532bbe0f
Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_112 (Oracle Corporation 25.112-b16)
OS: Mac OS X 10.10.5 x86_64
Tried setting additional properties on the ceylon configuration as explained in the plugin's documentation, such as
ceylon {
flatClasspath = false
importJars = true
forceImports = true
}
However the error persists. Any pointers on what I may be missing would be greatly appreciated.
This is because ceylon gradle plugin does not support yet the new feature --fully-export-maven-dependencies ... I created the issue now ;), so to make your project work you probably need to change each subproject/.ceylon/config with these options:
[compiler]
source=source
resource=resource
[defaults]
encoding=UTF-8
overrides=build/overrides.xml
flatclasspath=true
fullyexportmavendependencies=false
It will disable the new ceylon feature and uses ceylon gradle plugin feature and the generated overrides.xml file

gradle - why is this a dependency conflict or how to solve it?

Gradle reports a dependency conflict while I thought that I can resolve conflicts by forcing a particular version. Can someone please shed a light on this and how to force a particular version in any case?
This is the basic build script. It should work out of the box.
apply plugin: 'java'
ext {
version_spring = "4.0.4.RELEASE"
version_jbehave = "3.9.2"
}
repositories {
mavenCentral()
}
configurations.all {
resolutionStrategy {
failOnVersionConflict() ;; (1)
//
// The idea is to force a particular version of Spring
//
force "org:springframework:spring-core:${version_spring}"
force "org.springframework:spring-test:${version_spring}"
}
}
dependencies {
// Transitivily depending on org.springframework:spring-test:3.1.1.RELEASE
// Conflict is not resolved according to Gradle (see below)
compile "org.jbehave:jbehave-spring:${version_jbehave}"
}
Essentially I'm calling just "gradle dependencies". However, I'm throwing in various options to ensure that I'm not tricked by any cache.
$ gradle --no-daemon --cache rebuild --recompile-scripts \\
--refresh-dependencies --rerun-tasks dependencies
:dependencies
[..]
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dependencies'.
> Could not resolve all dependencies for configuration ':compile'.
> A conflict was found between the following modules:
- org.springframework:spring-core:3.1.1.RELEASE
- org.springframework:spring-core:4.0.4.RELEASE
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
[..]
I'm using the latest version of Gradle:
$ gradle -v
------------------------------------------------------------
Gradle 1.12
------------------------------------------------------------
Build time: 2014-04-29 09:24:31 UTC
Build number: none
Revision: a831fa866d46cbee94e61a09af15f9dd95987421
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
Ivy: 2.2.0
JVM: 1.8.0 (Oracle Corporation 25.0-b70)
OS: Mac OS X 10.8.5 x86_64
There is a typo in the build script - org:springframework should be org.springframework. Fixing the typo should solve the problem.
Have you tried again with Java 1.8.0_05 rather than using that old beta? Just curious.
Also, what do you get when you try to use Spring 3.2.8 instead of that 4.0.4 version?

Resources