vaadin / vaadin-gradle-plugin

Gradle plugin for Vaadin 14 applications. Takes care of front-end build, helps to configure repositories and to create various project and file templates.
Apache License 2.0
31 stars 9 forks source link

could not create Vfs.Dir from url, no matching UrlType #115

Closed jwn-css closed 3 years ago

jwn-css commented 3 years ago

Desktop (please complete the following information):

Describe the bug Error / Exception on task "vaadinPrepareFrontend"

To Reproduce Steps to reproduce the behavior:

  1. Setup vaadin project with dependencies other than *.jar
  2. Run Gradle task "build"
  3. See error:

_2021-05-29T18:38:04.517+0200 [WARN] [org.reflections.Reflections] could not create Vfs.Dir from url. ignoring the exception and continuing org.reflections.ReflectionsException: could not create Vfs.Dir from url, no matching UrlType was found [file:/C:/Users/\<User>/.gradle/caches/modules-2/files-2.1/com.microsoft.sqlserver/mssql-jdbc_auth/8.4.0.x64/90108f5fc6 0a177ac6ffcdd74a30dc68fd90b3f/mssql-jdbc_auth-8.4.0.x64.dll] either use fromURL(final URL url, final List urlTypes) or use the static setDefaultURLTypes(final List urlTypes) or addDefaultURLTypes(UrlType urlType) with your specialized UrlType. at org.reflections.vfs.Vfs.fromURL(Vfs.java:109) at org.reflections.vfs.Vfs.fromURL(Vfs.java:91) at org.reflections.Reflections.scan(Reflections.java:240) at org.reflections.Reflections.scan(Reflections.java:202) at org.reflections.Reflections.(Reflections.java:123) at com.vaadin.gradle.ReflectionsClassFinder.(ReflectionsClassFinder.kt:49) at com.vaadin.gradle.VaadinUtilsKt.getClassFinder(VaadinUtils.kt:63) at com.vaadin.gradle.VaadinUtilsKt.createNodeTasksBuilder(VaadinUtils.kt:157) at com.vaadin.gradle.VaadinPrepareFrontendTask.vaadinPrepareFrontend(VaadinPrepareFrontendTask.kt:85) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104) ...

Expected behavior Exclude unsupported libraries when scanning frontend dependencies so that no exception is thrown

mvysny commented 3 years ago

Excellent catch, thank you! What kind of dependency is that please? implementation("com.microsoft.sqlserver:mssql-jdbc_auth:8.4.0.x64") ?

jwn-css commented 3 years ago

It is necessary for accessing MSSQL databases from Java applications on Windows systems.

mvysny commented 3 years ago

Could you please share your build.gradle?

On Mon, May 31, 2021, 18:49 jwn-css @.***> wrote:

It is necessary for accessing MSSQL databases from Java applications on Windows systems.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/vaadin/vaadin-gradle-plugin/issues/115#issuecomment-851570404, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB6BCYVGLIN3K4ZOWSUOTDTQOVYBANCNFSM45YPD4UQ .

jwn-css commented 3 years ago

The dependency comes from internal dependencies that we can't change at the moment. So I don't think this is really helpful. The error also occurs when the package is added to the Vaadin Gradle Starter project as a dependency. Wouldn't it be possible to check the dependencies in question for their file extension and only include jar's in the consideration?

mvysny commented 3 years ago

Yes that sounds like a good fix. However i need to reproduce the bug locally first, in order to see whether the fix works. (And also to create a test case for the plugin later on). Can you create a small project which reproduces the issue please?

On Tue, Jun 1, 2021, 09:23 jwn-css @.***> wrote:

The dependency comes from internal dependencies that we can't change at the moment. So I don't think this is really helpful. The error also occurs when the package is added to the Vaadin Gradle Starter project as a dependency. Wouldn't it be possible to check the dependencies in question for their file extension and only include jar's in the consideration?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/vaadin/vaadin-gradle-plugin/issues/115#issuecomment-851854353, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB6BCZ36DQ2VFJK7GMOFZLTQR4HBANCNFSM45YPD4UQ .

jwn-css commented 3 years ago
plugins {
    id 'war'
    id 'org.gretty' version '3.0.3'
    id 'com.vaadin' version '0.14.5.1'
}

defaultTasks("clean", "build")

repositories {
    mavenCentral()
    jcenter()
}

gretty {
    contextPath = "/"
    servletContainer = "jetty9.4"
}

vaadin {
    pnpmEnable = true
}

dependencies {
    implementation enforcedPlatform('com.vaadin:vaadin-bom:14.5.1')
    implementation("com.vaadin:vaadin-core") {
        ["com.vaadin.webjar", "org.webjars.bowergithub.insites",
         "org.webjars.bowergithub.polymer", "org.webjars.bowergithub.polymerelements",
         "org.webjars.bowergithub.vaadin", "org.webjars.bowergithub.webcomponents"]
                .forEach { group -> exclude(group: group) }
    }
    implementation("com.microsoft.sqlserver:mssql-jdbc_auth:8.4.0.x64")
    providedCompile "javax.servlet:javax.servlet-api:3.1.0"
    implementation "org.slf4j:slf4j-simple:1.7.30"
}
mvysny commented 3 years ago

Thank you, reproduced & fixed :+1:

jwn-css commented 3 years ago

Nice, thank you!