devsoap / ds-gradle-vaadin

Gradle plugin for building Vaadin Flow 10/11/12/13/14/15 apps
https://devsoap.com/gradle-vaadin-flow-plugin
Other
36 stars 13 forks source link

Could not get unknown property 'JAVASCRIPT_FILE_TYPE' for task ':vaadinTranspileDependencies #286

Closed mvysny closed 4 years ago

mvysny commented 4 years ago

Hi John, thanks for the great plugin, keep up the great work :wave: I've tried to port the karibu10-helloworld-app to npm mode, unfortunately the Vaadin Gradle Flow plugin throws an exception for me. Please find the information attached below.

Desktop (please complete the following information):

Describe the bug The compilation of Vaadin Kotlin project fails.

To Reproduce Steps to reproduce the behavior:

  1. git clone https://github.com/mvysny/karibu10-helloworld-application
  2. Use the attached build.gradle.kts
  3. ./gradlew

Expected behavior The build should succeed.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context

The build.gradle.kts:

import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val karibudsl_version = "0.7.0"

plugins {
    kotlin("jvm") version "1.3.50"
    id("org.gretty") version "2.3.1"
    war
    id("com.devsoap.vaadin-flow") version "1.3.beta1"
}

vaadin {
    version = "14.0.7"
}

devsoap {
    email = "..."
    key = "...."
}

defaultTasks("clean", "build")

repositories {
    jcenter()
}

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

tasks.withType<Test> {
    useJUnitPlatform()
    testLogging {
        // to see the exceptions of failed tests in Travis-CI console.
        exceptionFormat = TestExceptionFormat.FULL
    }
}

val staging by configurations.creating

dependencies {
    // Karibu-DSL dependency
    compile("com.github.mvysny.karibudsl:karibu-dsl-v10:$karibudsl_version")

    vaadin.autoconfigure()

    // logging
    // currently we are logging through the SLF4J API to SLF4J-Simple. See src/main/resources/simplelogger.properties file for the logger configuration
    compile("org.slf4j:slf4j-simple:1.7.28")

    compile(kotlin("stdlib-jdk8"))

    // test support
    testCompile("com.github.mvysny.kaributesting:karibu-testing-v10:1.1.13")
    testCompile("com.github.mvysny.dynatest:dynatest-engine:0.15")

    // heroku app runner
    staging("com.github.jsimone:webapp-runner-main:9.0.24.0")
}

tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "1.8"
}

// Heroku
tasks {
    val copyToLib by registering(Copy::class) {
        into("$buildDir/server")
        from(staging) {
            include("webapp-runner*")
        }
    }
    val stage by registering {
        dependsOn("build", copyToLib)
    }
}

The stacktrace:

Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'JAVASCRIPT_FILE_TYPE' for task ':vaadinTranspileDependencies' of type com.devsoap.vaadinflow.tasks.TranspileDependenciesTask.
        at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:84)
        at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:61)
        at com.devsoap.vaadinflow.tasks.TranspileDependenciesTask_Decorated.getProperty(Unknown Source)
        at com.devsoap.vaadinflow.tasks.TranspileDependenciesTask$_bundle_closure25$_closure72.doCall(TranspileDependenciesTask.groovy:312)
        at com.devsoap.vaadinflow.tasks.TranspileDependenciesTask$_bundle_closure25.doCall(TranspileDependenciesTask.groovy:309)
        at com.devsoap.vaadinflow.tasks.TranspileDependenciesTask$_bundle_closure25.doCall(TranspileDependenciesTask.groovy)
        at com.devsoap.vaadinflow.util.LogUtils.measureTime(LogUtils.groovy:46)
        at com.devsoap.vaadinflow.util.LogUtils$measureTime$0.call(Unknown Source)
        at com.devsoap.vaadinflow.tasks.TranspileDependenciesTask.bundle(TranspileDependenciesTask.groovy:308)
        at com.devsoap.vaadinflow.tasks.TranspileDependenciesTask.run(TranspileDependenciesTask.groovy:459)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49)
mvysny commented 4 years ago

When I try ./gradlew -x vaadinTranspileDependencies the compilation succeeds, but none of the package.json, package-lock.json, webpack.config.js nor webpack.generated.js are generated.

Launching the project also fails with Unable to determine mode of operation. To use npm mode, ensure 'flow-build-info.json' exists on the classpath.

However, I tried to create a very simple test project using ./gradlew vaadinCreateProject and compiling that project succeeded (even though the package.json and other files were still not created). I can see from flow-build-info.json that the production mode has been used: {"compatibilityMode":false,"productionMode":true,"enableDevServer":false}.

Is the development mode supported yet please?

johndevs commented 4 years ago

Thanks for testing, helps a lot!

I'll try out your github repository this weekend and see where it is failing.

However, I tried to create a very simple test project using ./gradlew vaadinCreateProject and compiling that project succeeded (even though the package.json and other files were still not created).

The build files should be under <project root>/build/frontend. The plugin does not put them under the root as it clutters the project and prevents proper gradle caching.

Is the development mode supported yet please?

No development mode yet. Sorry :)

johndevs commented 4 years ago

@mvysny

Created PR https://github.com/mvysny/karibu10-helloworld-application/pull/3 to fix the remaining build issues. At least I got the project to run when providing the PRO credentials.