Saul Wiggin
12/17/2020, 3:14 PMDuplicate class org.apache.http.Consts found in modules jetified-httpclient-android-4.3.5 (org.apache.httpcomponents:httpclient-android:4.3.5) and jetified-httpcore-4.3 (org.apache.httpcomponents:httpcore:4.3.3)
The best guess I have currently is that something is duplicated or incorrect in the build.gradle file.Jeff Tycz
12/18/2020, 1:57 AM.kts
gradle file and I dont know how to convert them properly
here are my two tasks
task androidJavadocs(type: Javadoc) {
failOnError = false
source = android.sourceSets.main.java.srcDirs
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath += files(ext.androidJar)
exclude '**/R.html', '**/R.*.html', '**/index.html'
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
Can anyone help me out with this?christophsturm
12/18/2020, 12:18 PMincludeBuild("../nanotest")
and
testImplementation("nanotest:nanotest:0.1")
the build file of the library has this:
group = "nanotest"
version = "0.1"
and the settings file this:
rootProject.name = "nanotest"
but when i build gradle does not find it:
Could not resolve nanotest:nanotest:0.1.
Required by:
project :
I use composite builds all the time and it just works but now i have no idea whats wrongnapperley
12/20/2020, 3:09 AMsamuel
12/21/2020, 2:10 PMbuildSrc
and access that extension from all the gradle scripts in my project. I was under the impression that it was possible since all files under buildSrc
are automatically added to the class path but it doesn’t seem to work for me. When i define the extension in the same class as its usage, it works fine
build.gradle.kts
repositories {
myExtension()
}
fun RepositoryHandler.myExtension(): MavenArtifactRepository =
maven {
// Some code
}
But if i define the extension in another file, i can’t seem to get it to work as here:
build.gradle.kts
import extensions.myExtension
repositories {
myExtension()
}
buildSrc/src/main/kotlin/extensions/MyExtensionFile.kt
package extensions
// some imports
fun RepositoryHandler.myExtension(): MavenArtifactRepository =
maven {
// Some code
}
Specifying the extension in another file yields - Unresolved reference: extensions
.Is it possible to have such a setup with reusable extensions accessible from all the gradle files?mattinger
12/21/2020, 6:24 PMclasspath(platform(...))
classpath("com.android.tools.build:gradle")
ursus
12/22/2020, 2:36 PMplugins {
id("symbol-processing") version "1.4.20-dev-experimental-20201222"
}
I searched maven for "symbol-processing" as to give me the full path, but no luck -- where is that plugin hosted if nothing else is specified?ursus
12/23/2020, 1:15 AMsettings.gradle
?
(I noticed the Load/Unload Modules...
intellij option, which does exactly that, but for builds (green hammer icon), and sync times stay the same, even with the other apps modules unloaded -- so a no go)Steve Ramage
12/28/2020, 5:37 PMplugins {
...
id("io.gitlab.arturbosch.detekt") version "1.15.0" apply true
// ktlint linter - read more: <https://github.com/JLLeitschuh/ktlint-gradle>
id("org.jlleitschuh.gradle.ktlint") version "9.4.1" apply true
}
allprojects {
repositories {
mavenCentral()
jcenter()
}
apply(plugin = "io.gitlab.arturbosch.detekt")
apply(plugin = "org.jlleitschuh.gradle.ktlint")
dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.14.2")
}
// Configure detekt plugin.
// Read more: <https://detekt.github.io/detekt/kotlindsl.html>
detekt {
config = files("${rootProject.projectDir}/detekt-config.yml")
buildUponDefaultConfig = true
reports {
html.enabled = false
xml.enabled = false
txt.enabled = false
}
}
tasks {
withType<Detekt> {
jvmTarget = "11"
}
}
}
I'm getting the following errors:
e: ./build.gradle.kts:74:9: Unresolved reference: detektPlugins
e: ./build.gradle.kts:80:5: Unresolved reference: detekt
e: ./build.gradle.kts:81:9: Unresolved reference: config
e: ./build.gradle.kts:82:9: Unresolved reference: buildUponDefaultConfig
e: ./build.gradle.kts:84:9: Unresolved reference: reports
e: ./build.gradle.kts:85:13: Unresolved reference: html
e: ./build.gradle.kts:85:18: Variable expected
e: ./build.gradle.kts:86:13: Unresolved reference: xml
e: ./build.gradle.kts:86:17: Variable expected
e: ./build.gradle.kts:87:13: Unresolved reference: txt
e: ./build.gradle.kts:87:17: Variable expected
Steve Ramage
12/28/2020, 7:28 PMzsperske
12/29/2020, 5:09 PMrobstoll
01/03/2021, 9:48 PMsubprojects {
repositories {
mavenCentral()
jcenter()
}
}
Dependency is only available in jcenter but the build fails telling me that the dependency is not available in mavenCentral. How can I declare two repositories?
(https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:declaring_multiple_repositories looks like it should be correct)Vampire
01/04/2021, 9:37 PMGus
01/07/2021, 2:51 PMapi 'tech.relaycorp:relaynet:[1.40.0,2.0.0)'
, and I want to require 1.41.0
at a minimum. However, I keep getting the following error:
Execution failed for task ':compileKotlin'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find any version that matches tech.relaycorp:relaynet:[1.41.0,2.0.0).
Versions that do not match:
- 1.40.0
- 1.39.1
- 1.39.0
- 1.38.4
- 1.38.3
- + 76 more
Searched in the following locations:
- <https://jcenter.bintray.com/tech/relaycorp/relaynet/maven-metadata.xml>
However, if you download that maven-metadata.xml
file you'll find version 1.41.0
. I get that on CI (https://github.com/relaycorp/relaynet-jvm-testing/pull/21/files) and my local computer.
If I use api 'tech.relaycorp:relaynet:1.41.0
, gradle build
works, but I can't use a fixed version here.
Any thoughts on how to fix this?dirk.dittert
01/08/2021, 4:19 PMbuildSrc
to Kotlin. What is the equivalent to `project.android.buildTypes.all{buildType ->`(android
is not a property of project
)janvladimirmostert
01/09/2021, 11:08 AMbuild.gradle.kts
you can set the version for all plugins:
plugins {
val kotlinVersion = "1.4.21"
val shadowVersion = "6.0.0"
kotlin("multiplatform").version(kotlinVersion).apply(false)
kotlin("plugin.serialization").version(kotlinVersion).apply(false)
id("com.github.johnrengelman.shadow").version(shadowVersion).apply(false)
}
is there a way to do it with dependencies as well?
I've tried adding a dependency block with a constraint{...}
, but the IDE doesn't allow me to add an implementation(...)
inside such a constraint blocktieskedh
01/10/2021, 9:37 PM-samplessources
for some reason.
Without that, it should be able to resolve the dependency..Tomas Kormanak
01/13/2021, 10:25 AMDariusz Kuc
01/13/2021, 2:15 PM.m2/repository
it works initially but then it subsequently fails (i.e. only sees ktor-client-cio
which fails the build as it needs ktor-client-cio-jvm
).
Chain of events (from the linked PR GH build action):
• manually wipe out .m2/repository
and start a build
• project A and B are build fine and are able to resolve the -jvm
artifacts
• integration tests kick in for maven and gradle plugins
- maven tests work fine
- gradle tests (using GradleRunner) fail to resolve -jvm
artifacts
• project A and B cannot be build anymore and are unable to resolve the -jvm
artifacts
Locally
• wipe out the .m2/repository
• build project A or B from command line using Gradle wrapper - works fine
• reload project in IDEA (which uses Gradle wrapper) -> cannot resolve the -jvm
artifactssamuel
01/13/2021, 5:04 PMfastInit
like this:
kapt {
javacOptions {
option("-Adagger.fastInit=enabled")
}
}
I see some warnings that don’t feel clear to me, does anyone know what could trigger such warnings?
warning: The following options were not recognized by any processor: '[dagger.fastInit, kapt.kotlin.generated]'
The following options were not recognized by any processor: '[dagger.fastInit, kapt.kotlin.generated]'
These warnings only affect very few modulesErik
01/14/2021, 2:01 PMtestImplementation 'org.jetbrains.kotlin:kotlin-test-junit'
, it seems that I don't have to specify a version! Why?
I don't have the Kotlin BOM specified either. Only the kotlin-test
dep. And of course the Kotlin Gradle plugin. I know that this version automatically provides the kotlin-stdlib
version including the variant (e.g. JDK8), but judging by this behaviour, it also seems that it provides some kind of Kotlin BOM platform (or at least version constraints) for the kotlin-test
dep (and who knows what others). How does this work?
And is it ok to rely on the Kotlin Gradle Plugin version for the kotlin-test
dependency?janvladimirmostert
01/16/2021, 12:00 PMinclude("project-a:module-4")
project(":project-a:module-4").projectDir =
File("../project-a/module-4")
ProjectB Module4's build.gradle.kts
sourceSets {
val jvmMain by getting {
dependencies {
...
implementation(project(":project-a:module-4"))
}
}
}
this compiles, but nothing resolvesMarc Knaup
01/17/2021, 11:47 PMjava.lang.StackOverflowError
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.NodeState.findExternalVariant(NodeState.java:1267)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.NodeState.getResolvedVariant(NodeState.java:1252)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.getSelectedVariant(EdgeState.java:385)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.NodeState.findExternalVariant(NodeState.java:1267)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.NodeState.getResolvedVariant(NodeState.java:1252)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.getSelectedVariant(EdgeState.java:385)
suresh
01/18/2021, 7:41 AM--add-opens
option to Kotlin compile task? I was testing the recent loom EA build (JDK 17, which has enabled strong encapsulation of some jdk packages) and failing with the following error.
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.util.ResourceBundle.setParent(java.util.ResourceBundle) accessible: module java.base does not "opens java.util" to unnamed module @358e9d30
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at org.jetbrains.kotlin.com.intellij.util.ReflectionUtil.makeAccessible(ReflectionUtil.java:252)
at org.jetbrains.kotlin.com.intellij.util.ReflectionUtil.getDeclaredMethod(ReflectionUtil.java:269)
at org.jetbrains.kotlin.com.intellij.DynamicBundle.<clinit>(DynamicBundle.java:22)
... 38 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileKotlin'.
> Internal compiler error. See log for more details
The fix is to add --add-opens java.base/java.util=ALL-UNNAMED
option when running java.
I tried to set this option in all the following places like
1. gradle properties org.gradle.jvmargs=
2. export JAVA_OPTS="--add-opens java.base/java.util=ALL-UNNAMED"
3. java compile task
compilerArgs.addAll(
listOf(
"--enable-preview",
"--add-opens",
"java.base/java.util=ALL-UNNAMED"
4. Kotlin compile task
freeCompilerArgs += listOf(
"-progressive",
"-Xjavac-arguments=" + listOf(
"--add-opens",
"java.base/java.util=ALL-UNNAMED"
).joinToString(separator = ",")
None of these options worked and still getting the above error. Any hint on how to open JDK modules to my all application packages?Vampire
01/18/2021, 8:37 AM--add-opens,java.base/java.util=ALL-UNNAMED
, this is most likely not correct. I wonder that it did not complain about that syntaxmurdock
01/18/2021, 1:57 PMMorten Andersen-Gott
01/20/2021, 2:56 PMcom.ewerk.gradle.plugins.jaxb2
-plugin. So far I’ve got the classes generated, but they don’t seem to be added to my classpath correctly, as I can’t use them from my kotlin source code. The generated java classes are put in src/generated/java
. anyone got any experience with using java generators in componation with kotlin? Or got a working jaxb/kotlin/gradle/kotlin-dsl example?rook
01/20/2021, 5:19 PMbuildSrc
. The error I’m getting is the following
Could not find implementation class 'rook.bluetoothpoc.MyPlugin' for plugin 'rook.bluetoothpoc' specified in buildSrc.jar!/META-INF/gradle-plugins/rook.bluetoothpoc.properties
The path to MyPlugin
is root/buildSrc/src/main/java/rook/bluetoothpoc/
.
The path to rook.bluetoothpoc.properties
is root/buildSrc/main/resources/META-INF/gradle-plugins/
. It contains only the following line:
implementation-class=rook.bluetoothpoc.MyPlugin
I feel like I’m missing something really obvious.Dariusz Kuc
01/20/2021, 11:03 PM-jvm
artifacts (e.g. given io.ktor:ktor-client-cio
we expect io.ktor:ktor-client-cio-jvm
to be picked up on JVM builds)?LevT
01/21/2021, 12:09 PMbuild.gradle.kts
for property testing with Kotest
I'd prefer to try it in parallel (not technically said)
with another recommended for Kotlin/JVM engine (jqwik? or any preferred over it)
And I'm still having no sense of kotlin.testLevT
01/21/2021, 12:09 PMbuild.gradle.kts
for property testing with Kotest
I'd prefer to try it in parallel (not technically said)
with another recommended for Kotlin/JVM engine (jqwik? or any preferred over it)
And I'm still having no sense of kotlin.testplugins {
kotlin("jvm") version "1.4.21"
id("io.kotest") version "0.2.6"
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
jcenter()
}
dependencies {
implementation("com.google.code.gson:gson:2.8.5")
testImplementation(platform("org.junit:junit-bom:5.7.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("io.kotest:kotest-assertions-core-jvm:4.3.2")
testImplementation("io.kotest:kotest-framework-engine-jvm:4.3.2")
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
How can I know if kotest is working here on itself or via junit5?
I am curious about a real check, being aware of the word of the plugin documentation.
And please help me adding another PTE (recommended in any opinionated sense)sam
01/23/2021, 5:57 AMLevT
01/23/2021, 7:07 AMsam
01/24/2021, 5:16 PM