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

Spring boot war #294

Open jarkko-sokeila opened 4 years ago

jarkko-sokeila commented 4 years ago

I created vaadin 14 project with productionMode true and compatibilityMode false. When I run bootRun gradle task or run project in eclipse with spring tool suite 4 everything works fine. But when I build project and run war in command line I get this error

2019-10-19 12:07:56.510 ERROR 14032 --- [nio-8080-exec-6] c.v.flow.server.DefaultErrorHandler
java.lang.IllegalStateException: Couldn't find the definition of the element with tag 'hello-button' in any template file declared using '@JsModule' annotations. Check the availability of the template files in your WAR file or provide alternative implementation of the method getTemplateContent() which should return an element representing the content of the template file

Is this bug in plugin or what I do wrong?

jarkko-sokeila commented 4 years ago

Any comment why war/jar doesn't work?

johndevs commented 4 years ago

Hi, could you try the latest beta version and see if you still get the same? (1.3.beta6)

jarkko-sokeila commented 4 years ago

Hi, same exception come with 1.3.beta6 What I do is I create project with vaadinCreateProject gradle task, then run bootRun task and everything works fine. But when I run build task and run generated war in command line I will get this error when I try to use example application. Full stack trace in file My build.gradle looks like this

plugins { id 'java' id 'eclipse-wtp' id 'war' id 'org.springframework.boot' version '2.2.0.RELEASE' id 'io.spring.dependency-management' version '1.0.8.RELEASE' }

apply from: 'C:/gradle-vaadin-flow/local.plugin'

sourceCompatibility = 11.0

vaadin { version = '14.0.11' productionMode = true compatibilityMode = false }

vaadin.autoconfigure()

dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' }

error.txt

flefebure commented 4 years ago

Hi John,

I 've made some comments in your #240 some monthes ago.

We are still in dev-mode. So packaging is not yet a priority. Anyway we keep an eye to your plugin. (but we a Maven comeback is still an option). In the first 14x versions, Flow and its Maven plugin had bugs with Spring layout, but it has been corrected in september, in the 14.0.3, I think. https://github.com/vaadin/flow/issues/6306

Today I gave a try to your latest version 1.3.1. So I converted my multimodule spring test project to Gradle https://github.com/flefebure/flow-spring-examples

With Maven I can do without problem mvn -PproductionMode clean package java -jar ui-bootstrap/target/ui-bootstrap-1.0.0-SNAPSHOT.jar

With gradle there is problem with gradle -PproductionMode clean bootWar java -DproductionMode=true -jar ui-bootstrap/build/libs/ui-bootstrap-1.0.0-SNAPSHOT.war

Be sure that we will pay the plugin if it is useable.

Franck

johndevs commented 4 years ago

Hi @flefebure

There was just some small changes that needed to be done, so I created a PR to fix your issues with your example Gradle project (https://github.com/flefebure/flow-spring-examples/pull/1).

Since the project is using the NPM you will need a PRO subscription to build it.

flefebure commented 4 years ago

Thanks for your quick answer,

Yeah we are going to buy the pro

Just a question, I saw you moved the resources in src/main/[javascript|stylesheets] But the Vaadin documentation says that resources are supposed to be located in src/main/resources/META-INF/resources/frontend

Actually, we are working using the embedded vaadin "webpack-dev-server" After your PR, it looks that becomes impossible, may be due to theses resources locations change

You can try it by yourself by running "TutorialApplication" directly in Idea/Eclipse compare the current trunk with before the pr merge