quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.54k stars 2.61k forks source link

Multiple sourceDirs for Gradle are not supported. #5539

Open soberich opened 4 years ago

soberich commented 4 years ago

Describe the bug Multiple sourceDirs for Gradle are not supported.

Actual behavior

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':time-service.app:quarkusDev' (type 'QuarkusDev').
> Directory '/Users/Projects/marvel/time-service/app/src/main/java:/Users/Projects/marvel-github/time-service/app/src/main/kotlin' specified for property 'sourceDir' does not exist.
...
* Exception is:
org.gradle.internal.execution.WorkValidationException: A problem was found with the configuration of task ':time-service.app:quarkusDev' (type 'QuarkusDev').
...
Caused by: org.gradle.api.InvalidUserDataException: Directory '/Users/Projects/marvel/time-service/app/src/main/java:/Users/Projects/marvel/time-service/app/src/main/kotlin' specified for property 'sourceDir' does not exist.
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:400)
    at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:500)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
    ... 43 more

if specify

quarkus {
    setSourceDir("$projectDir/src/main/kotlin")
}

a non-sence forlder structure created

./build/classes
├── java
│   ├── main
│   │   └── com
│   │       └── example
│   │           └── marvel ...
│   └── main:
│       └── Users
│           └── Projects
│               └── marvel
│                   └── time-service
│                       └── app
│                           └── build
│                               └── classes
│                                   └── kotlin
│                                       └── main:
│                                           └── Users
│                                               └── Projects
│                                                   └── marvel
│                                                       └── time-service
│                                                           └── app
│                                                               └── build
│                                                                   └── tmp
│                                                                       └── kapt3
│                                                                           └── classes
│                                                                               └── main
│                                                                                   ├── META-INF
│                                                                                   │   └── resources
│                                                                                   │       └── swagger-ui
│                                                                                   └── com
│                                                                                       └── example
│                                                                                           └── marvel ...
└── kotlin
    └── main
        ├── META-INF
        └── com
            └── example
                └── marvel ...

To Reproduce Steps to reproduce the behavior:

git clone -b quarkus-template git@github.com:soberich/marvel.git marvel && cd $_ && ./gradlew quarkusDev

Configuration

# Add your application.properties here, if applicable.

Environment (please complete the following information):

------------------------------------------------------------
Gradle 6.0
------------------------------------------------------------

Build time:   2019-11-08 18:12:12 UTC
Revision:     0a5b531749138f2f983f7c888fa7790bfc52d88a

Kotlin:       1.3.50
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          1.8.0_232 (AdoptOpenJDK 25.232-b09)
OS:           Mac OS X 10.14.6 x86_64

Additional context Quarkus 1.0.0.CR1

aloubyansky commented 4 years ago

Still fails with 1.3.0.Final with

2020-03-13 14:42:31,735 ERROR [io.qua.dev.DevModeMain] (main) Failed to start Quarkus: java.lang.ExceptionInInitializerError
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:398)
        at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:80)
        at io.quarkus.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:60)
        at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:236)
        at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:39)
        at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:131)
        at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:84)
        at io.quarkus.dev.DevModeMain.start(DevModeMain.java:108)
        at io.quarkus.dev.DevModeMain.main(DevModeMain.java:47)
Caused by: java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:506)
        ... 10 more
Caused by: java.util.ServiceConfigurationError: io.undertow.servlet.ServletExtension: io.undertow.websockets.jsr.Bootstrap not a subtype
        at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:588)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1236)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1264)
        at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299)
        at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1384)
        at io.undertow.servlet.core.DeploymentManagerImpl.handleExtensions(DeploymentManagerImpl.java:276)
        at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:155)
        at io.quarkus.undertow.runtime.UndertowDeploymentRecorder.bootServletContainer(UndertowDeploymentRecorder.java:442)
        at io.quarkus.deployment.steps.UndertowBuildStep$build44.deploy_0(UndertowBuildStep$build44.zig:153)
        at io.quarkus.deployment.steps.UndertowBuildStep$build44.deploy(UndertowBuildStep$build44.zig:178)
        at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:492)
        ... 10 more

Changes applied to the reproducer

diff --git a/buildSrc/src/main/kotlin/versioning/Platforms.kt b/buildSrc/src/main/kotlin/versioning/Platforms.kt
index df9c208..ccc5f7d 100644
--- a/buildSrc/src/main/kotlin/versioning/Platforms.kt
+++ b/buildSrc/src/main/kotlin/versioning/Platforms.kt
@@ -8,7 +8,7 @@ object Platforms {
         const val BLAZE_JPA    = "1.3.2"
         const val COROUTINES   = "1.3.2"
         const val JACKSON      = "2.9.10"
-        const val QUARKUS      = "1.0.0.CR1"
+        const val QUARKUS      = "1.3.0.Final"
         const val REACTOR      = "Dysprosium-SR1"
         const val RESTEASY     = "4.1.1.Final"
         const val SPRING_BOOT  = "2.2.0.RELEASE"
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 9f303b1..a444fe9 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -5,6 +5,7 @@

 pluginManagement {
     repositories {
+        mavenLocal()
         gradlePluginPortal()
         mavenCentral()
         maven("https://dl.bintray.com/kotlin/kotlin-eap") {
@@ -21,7 +22,7 @@
     resolutionStrategy {
         eachPlugin {
             if (requested.id.id == "io.quarkus") {
-                useModule("io.quarkus:quarkus-gradle-plugin:${requested.version}")
+                useModule("io.quarkus:io.quarkus.gradle.plugin:${requested.version}")
AdlerFleurant commented 1 year ago

I have recently tested a project with multiple sources. It works just fine. The latest error had nothing to do with multiple source directories. @gsmet, @soberich, shouldn't this be closed?

geoand commented 1 year ago

@aloubyansky @glefloch can you confirm this now works?

aloubyansky commented 1 year ago

I'm having troubles running the reproducer, it appears to be quite old. I would trust @AdlerFleurant on this. @glefloch and @soberich unless you are aware of a current issue related to this, I would close this one. Thanks.