gradle / kotlin-dsl-samples

Samples builds using the Gradle Kotlin DSL
https://gradle.org/kotlin/
Other
3.71k stars 433 forks source link

error module reading from both ....and .... #1381

Closed jagiellonczyk14 closed 5 years ago

jagiellonczyk14 commented 5 years ago

Current Behavior

I am trying to update my code to java 12 I took sample from https://github.com/openjfx/samples - intellij - gradle - modular - it worked until I added dependencies and some kotlin code into the project I got the error while trying to compile my build

error

Information:Kotlin: kotlinc-jvm 1.3.31 (JRE 12.0.1+12)
Information:java: Errors occurred while compiling module 'hellofx.main'
Information:javac 12.0.1 was used to compile java sources
Information:Module "hellofx.main" was fully rebuilt due to project configuration/dependencies changes
Information:04.05.19 09:52 - Build completed with 100 errors and 3 warnings in 6 s 902 ms
Error:java: the unnamed module reads package org.apache.avalon.framework from both avalon.framework.impl and avalon.framework.api
Error:java: the unnamed module reads package org.apache.avalon.framework.service from both avalon.framework.impl and avalon.framework.api
Error:java: the unnamed module reads package org.apache.avalon.framework.logger from both avalon.framework.impl and avalon.framework.api
Error:java: the unnamed module reads package org.apache.avalon.framework.context from both avalon.framework.impl and avalon.framework.api
Error:java: the unnamed module reads package org.apache.avalon.framework.configuration from both avalon.framework.impl and avalon.framework.api
Error:java: the unnamed module reads package org.apache.avalon.framework.component from both avalon.framework.impl and avalon.framework.api
Error:java: the unnamed module reads package org.apache.xml.serializer from both serializer and docx4j
Error:java: the unnamed module reads package kotlin.internal from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: the unnamed module reads package kotlin from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module kotlin.reflect reads package org.apache.avalon.framework from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlin.reflect reads package org.apache.avalon.framework.service from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlin.reflect reads package org.apache.avalon.framework.logger from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlin.reflect reads package org.apache.avalon.framework.context from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlin.reflect reads package org.apache.avalon.framework.configuration from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlin.reflect reads package org.apache.avalon.framework.component from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlin.reflect reads package org.apache.xml.serializer from both serializer and docx4j
Error:java: module kotlin.reflect reads package kotlin.internal from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module kotlin.reflect reads package kotlin from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module docx4j reads package org.apache.avalon.framework from both avalon.framework.impl and avalon.framework.api
Error:java: module docx4j reads package org.apache.avalon.framework.service from both avalon.framework.impl and avalon.framework.api
Error:java: module docx4j reads package org.apache.avalon.framework.logger from both avalon.framework.impl and avalon.framework.api
Error:java: module docx4j reads package org.apache.avalon.framework.context from both avalon.framework.impl and avalon.framework.api
Error:java: module docx4j reads package org.apache.avalon.framework.configuration from both avalon.framework.impl and avalon.framework.api
Error:java: module docx4j reads package org.apache.avalon.framework.component from both avalon.framework.impl and avalon.framework.api
Error:java: module docx4j reads package org.apache.xml.serializer from both serializer and docx4j
Error:java: module docx4j reads package kotlin.internal from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module docx4j reads package kotlin from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module slf4j.api reads package org.apache.avalon.framework from both avalon.framework.impl and avalon.framework.api
Error:java: module slf4j.api reads package org.apache.avalon.framework.service from both avalon.framework.impl and avalon.framework.api
Error:java: module slf4j.api reads package org.apache.avalon.framework.logger from both avalon.framework.impl and avalon.framework.api
Error:java: module slf4j.api reads package org.apache.avalon.framework.context from both avalon.framework.impl and avalon.framework.api
Error:java: module slf4j.api reads package org.apache.avalon.framework.configuration from both avalon.framework.impl and avalon.framework.api
Error:java: module slf4j.api reads package org.apache.avalon.framework.component from both avalon.framework.impl and avalon.framework.api
Error:java: module slf4j.api reads package org.apache.xml.serializer from both serializer and docx4j
Error:java: module slf4j.api reads package kotlin.internal from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module slf4j.api reads package kotlin from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module kotlinx.coroutines.javafx reads package org.apache.avalon.framework from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlinx.coroutines.javafx reads package org.apache.avalon.framework.service from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlinx.coroutines.javafx reads package org.apache.avalon.framework.logger from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlinx.coroutines.javafx reads package org.apache.avalon.framework.context from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlinx.coroutines.javafx reads package org.apache.avalon.framework.configuration from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlinx.coroutines.javafx reads package org.apache.avalon.framework.component from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlinx.coroutines.javafx reads package org.apache.xml.serializer from both serializer and docx4j
Error:java: module kotlinx.coroutines.javafx reads package kotlin.internal from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module kotlinx.coroutines.javafx reads package kotlin from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module kotlinx.coroutines.core reads package org.apache.avalon.framework from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlinx.coroutines.core reads package org.apache.avalon.framework.service from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlinx.coroutines.core reads package org.apache.avalon.framework.logger from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlinx.coroutines.core reads package org.apache.avalon.framework.context from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlinx.coroutines.core reads package org.apache.avalon.framework.configuration from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlinx.coroutines.core reads package org.apache.avalon.framework.component from both avalon.framework.impl and avalon.framework.api
Error:java: module kotlinx.coroutines.core reads package org.apache.xml.serializer from both serializer and docx4j
Error:java: module kotlinx.coroutines.core reads package kotlin.internal from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module kotlinx.coroutines.core reads package kotlin from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module kotson reads package org.apache.avalon.framework from both avalon.framework.impl and avalon.framework.api
Error:java: module kotson reads package org.apache.avalon.framework.service from both avalon.framework.impl and avalon.framework.api
Error:java: module kotson reads package org.apache.avalon.framework.logger from both avalon.framework.impl and avalon.framework.api
Error:java: module kotson reads package org.apache.avalon.framework.context from both avalon.framework.impl and avalon.framework.api
Error:java: module kotson reads package org.apache.avalon.framework.configuration from both avalon.framework.impl and avalon.framework.api
Error:java: module kotson reads package org.apache.avalon.framework.component from both avalon.framework.impl and avalon.framework.api
Error:java: module kotson reads package org.apache.xml.serializer from both serializer and docx4j
Error:java: module kotson reads package kotlin.internal from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module kotson reads package kotlin from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module sqlite.jdbc reads package org.apache.avalon.framework from both avalon.framework.impl and avalon.framework.api
Error:java: module sqlite.jdbc reads package org.apache.avalon.framework.service from both avalon.framework.impl and avalon.framework.api
Error:java: module sqlite.jdbc reads package org.apache.avalon.framework.logger from both avalon.framework.impl and avalon.framework.api
Error:java: module sqlite.jdbc reads package org.apache.avalon.framework.context from both avalon.framework.impl and avalon.framework.api
Error:java: module sqlite.jdbc reads package org.apache.avalon.framework.configuration from both avalon.framework.impl and avalon.framework.api
Error:java: module sqlite.jdbc reads package org.apache.avalon.framework.component from both avalon.framework.impl and avalon.framework.api
Error:java: module sqlite.jdbc reads package org.apache.xml.serializer from both serializer and docx4j
Error:java: module sqlite.jdbc reads package kotlin.internal from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module sqlite.jdbc reads package kotlin from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module com.google.common reads package org.apache.avalon.framework from both avalon.framework.impl and avalon.framework.api
Error:java: module com.google.common reads package org.apache.avalon.framework.service from both avalon.framework.impl and avalon.framework.api
Error:java: module com.google.common reads package org.apache.avalon.framework.logger from both avalon.framework.impl and avalon.framework.api
Error:java: module com.google.common reads package org.apache.avalon.framework.context from both avalon.framework.impl and avalon.framework.api
Error:java: module com.google.common reads package org.apache.avalon.framework.configuration from both avalon.framework.impl and avalon.framework.api
Error:java: module com.google.common reads package org.apache.avalon.framework.component from both avalon.framework.impl and avalon.framework.api
Error:java: module com.google.common reads package org.apache.xml.serializer from both serializer and docx4j
Error:java: module com.google.common reads package kotlin.internal from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module com.google.common reads package kotlin from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module tornadofx reads package org.apache.avalon.framework from both avalon.framework.impl and avalon.framework.api
Error:java: module tornadofx reads package org.apache.avalon.framework.service from both avalon.framework.impl and avalon.framework.api
Error:java: module tornadofx reads package org.apache.avalon.framework.logger from both avalon.framework.impl and avalon.framework.api
Error:java: module tornadofx reads package org.apache.avalon.framework.context from both avalon.framework.impl and avalon.framework.api
Error:java: module tornadofx reads package org.apache.avalon.framework.configuration from both avalon.framework.impl and avalon.framework.api
Error:java: module tornadofx reads package org.apache.avalon.framework.component from both avalon.framework.impl and avalon.framework.api
Error:java: module tornadofx reads package org.apache.xml.serializer from both serializer and docx4j
Error:java: module tornadofx reads package kotlin.internal from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module tornadofx reads package kotlin from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module com.squareup.kotlinpoet reads package org.apache.avalon.framework from both avalon.framework.impl and avalon.framework.api
Error:java: module com.squareup.kotlinpoet reads package org.apache.avalon.framework.service from both avalon.framework.impl and avalon.framework.api
Error:java: module com.squareup.kotlinpoet reads package org.apache.avalon.framework.logger from both avalon.framework.impl and avalon.framework.api
Error:java: module com.squareup.kotlinpoet reads package org.apache.avalon.framework.context from both avalon.framework.impl and avalon.framework.api
Error:java: module com.squareup.kotlinpoet reads package org.apache.avalon.framework.configuration from both avalon.framework.impl and avalon.framework.api
Error:java: module com.squareup.kotlinpoet reads package org.apache.avalon.framework.component from both avalon.framework.impl and avalon.framework.api
Error:java: module com.squareup.kotlinpoet reads package org.apache.xml.serializer from both serializer and docx4j
Error:java: module com.squareup.kotlinpoet reads package kotlin.internal from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module com.squareup.kotlinpoet reads package kotlin from both kotlin.stdlib and kotlin.stdlib.jre7
Error:java: module jcl.over.slf4j reads package org.apache.avalon.framework from both avalon.framework.impl and avalon.framework.api
Warning:Kotlin: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    /home/jakub/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.31/11289d20fd95ae219333f3456072be9f081c30cc/kotlin-stdlib-1.3.31.jar (version 1.3)
    /home/jakub/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.3.21/d0d5ff2ac2ebd8a42697af41e20fc225a23c5d3b/kotlin-reflect-1.3.21.jar (version 1.3)
    /home/jakub/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.3.31/21edc5a6b2e39bc4dc2860346fd778e27503d6cb/kotlin-stdlib-jdk8-1.3.31.jar (version 1.3)
    /home/jakub/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jre7/1.2.21/3beb08c67673033183c8652572680587876e64b5/kotlin-stdlib-jre7-1.2.21.jar (version 1.2)
    /home/jakub/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.3.31/e652770b6416c6d85934086899ffed3eccd35813/kotlin-stdlib-jdk7-1.3.31.jar (version 1.3)
    /home/jakub/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.31/20c34a04ea25cb1ef0139598bd67c764562cb170/kotlin-stdlib-common-1.3.31.jar (version 1.3)
Warning:Kotlin: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
/home/jakub/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jre7/1.2.21/3beb08c67673033183c8652572680587876e64b5/kotlin-stdlib-jre7-1.2.21.jar
Warning:Kotlin: kotlin-stdlib-jre7 is deprecated. Please use kotlin-stdlib-jdk7 instead

build gradle `

plugins {
  id ("application")
  id ("org.openjfx.javafxplugin") version "0.0.7"
    kotlin("jvm") version "1.3.31"
}

repositories {
    mavenCentral()
    google()
    jcenter()

}

dependencies {
    val kotlinVersion = "1.3.21"
    val spekVersion = "2.0.1"

    implementation(kotlin("stdlib-jdk8"))

    compile( "org.xerial:sqlite-jdbc:3.23.1")
    compile ("no.tornado:tornadofx:1.7.17")
    compile ("com.squareup:kotlinpoet:0.7.0")
    compile( "com.github.salomonbrys.kotson:kotson:2.5.0")
    compile ("com.google.guava:guava:25.1-jre")
    compile ("com.jfoenix:jfoenix:9.0.8")
    compile ("org.jetbrains.kotlinx:kotlinx-coroutines-javafx:1.2.0")
    compile ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.0")
    compile ("org.slf4j:slf4j-api:1.7.5")
    compile( "org.docx4j:docx4j:3.3.7")
    compile ("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
    compile ("joda-time:joda-time:2.9.9")
    compile ("com.h2database:h2:1.4.199")
    testCompile ("org.jetbrains.kotlin:kotlin-test:${kotlinVersion}")
    testImplementation ("org.spekframework.spek2:spek-dsl-jvm:$spekVersion")
    testRuntimeOnly ("org.spekframework.spek2:spek-runner-junit5:$spekVersion")
    testCompile( "org.amshove.kluent:kluent:1.38")

}

javafx {
    version = "12"
    modules("javafx.controls","javafx.base", "javafx.fxml", "javafx.web", "javafx.graphics")}

application {
    mainClassName = "$moduleName/org.openjfx.MainApp"
}
configure<JavaPluginConvention> {
    sourceCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "1.8"
}

settings gradle rootProject.name = "hellofx"

I had added also kotlin standard library to module info

`module hellofx {
   requires javafx.controls;
    requires javafx.fxml;
    requires kotlin.stdlib;
    requires com.squareup.kotlinpoet;
    requires tornadofx;
    requires com.jfoenix;
    requires com.google.common;
    requires sqlite.jdbc;
    requires kotson;
    requires kotlinx.coroutines.core;
    requires kotlinx.coroutines.javafx;
    requires slf4j.api;
    requires docx4j;
    requires kotlin.reflect;
    requires joda.time;
    requires com.h2database;
    opens org.openjfx to javafx.fxml;
    exports org.openjfx;

}`

the structure of the program was only slightly changed - I transformed build gradle and setting gradle to kotlin and added source root for kotlin image

Your Environment

Intellij 2019.1.1 java: openJdk12 gradle 5,4 system Ubuntu kotlin plugin v1.3.31-release-IJ2019.1-1

eskatos commented 5 years ago

Closing as duplicate of https://github.com/gradle/gradle/issues/9349