Polymer Template cannot be found as soon as it is part of a dependency. The reason for this might be my own fault f.e. maybe @HTMLImport should not be used by addons?, or rather the lack of documentation for this very specific case. I would be really glad if somebody could help me out on this.
An example project can be found here to get the two behaviours:
install goal on the parent modulejetty:run on the addon module the template is foundjetty:run on the demo module the template cannot be foundThe template should be found.
java.lang.IllegalStateException: Can't find resource 'context://iron-dropdown-wrapper/iron-dropdown-animation.html' via the servlet context
at com.vaadin.flow.component.polymertemplate.DefaultTemplateParser.getTemplateContent(DefaultTemplateParser.java:104)
at com.vaadin.flow.component.polymertemplate.TemplateDataAnalyzer.parseTemplate(TemplateDataAnalyzer.java:185)
at com.vaadin.flow.component.polymertemplate.TemplateInitializer.<init>(TemplateInitializer.java:93)
at com.vaadin.flow.component.polymertemplate.PolymerTemplate.<init>(PolymerTemplate.java:97)
at com.vaadin.flow.component.polymertemplate.PolymerTemplate.<init>(PolymerTemplate.java:112)
at com.github.appreciated.dropdown.IronDropdownWrapper.<init>(IronDropdownWrapper.java:30)
at com.github.appreciated.dropdown.IronDropdownWrapper.<init>(IronDropdownWrapper.java:27)
at com.github.appreciated.MainView.getIronDropDown(MainView.java:54)
at com.github.appreciated.MainView.<init>(MainView.java:30)
... 48 more
I think you have the local frontend resources in the wrong location and those are not picked for the jar but instead for a war they would be. You should put them to src/main/resources/META-INF/resoures/frontend, see example from Grid: https://github.com/vaadin/vaadin-grid-flow/tree/master/src/main/resources/META-INF/resources/frontend
The tutorial https://vaadin.com/docs/v10/flow/web-components/creating-an-in-project-web-component.html describes how to make a component for a webapp project. There the files are put to the /webapp/ folder. I actually don't see any place where we mention that where you should put the files when you make an add-on that has local resources that should go to a jar artifact.
Maybe we should add documentation / tutorial for this, if this was the issue. Thus an issue for vaadin/flow-and-components-documentation repository would be great.
@pleku First of all thank you very much this worked! Now the template is found in the dependency but it isn't found in the addon module itself anymore. Which isn't ideal since I would need to duplicate the files to run the DemoView in the module itself.
- execute
jetty:runon the addon module ...
Couldn't this be done more ideal by using a Maven plugin?
But it isn't found in the addon module itself anymore
I think you need to define the resourceBase for the add-on module, see: https://github.com/vaadin/vaadin-grid-flow/blob/master/pom.xml#L123
You indeed are a champ thanks again for your time!