I created a web component, and added it to our project as a new module. The following is from our parent project’s pom.xml:
<modules>
<module>ProjectA</module>
<module>ProjectB</module>
<module>ProjectC</module>
<module>ProjectD</module>
<module>ProjectE</module>
<module>ProjectF</module>
<!-- New web component -->
<module>OpenLayersMap</module>
</modules>
mvn clean install works. All projects are compiled, and the classes from the new web component (OpenLayersMap) can be imported into the other projects. Good!
However, when I run mvn spring-boot:run on ProjectA, I get some odd errors (stacktrace attached). The two that jump out at me are:
java.lang.IllegalStateException: Failed to update the Flow imports file 'C:\iris\OpenLayersMap\target\frontend\generated-flow-imports.js' - this is from the new web component project.
Caused by: java.lang.IllegalStateException:
Failed to find the following css files in the 'node_modules' or '/frontend' tree:
- ./styles/inws-styles.css
Check that they exist or are installed.
All projects are getting packaged as JARs, and I’m 99% sure the stylesheet import above was working prior to adding this web component to our project. Just in case, here’s the stylesheet import code:
@CssImport("./styles/inws-styles.css")
public class MainView extends AppLayout {
java.lang.IllegalStateException: Failed to update the Flow imports file 'C:<Module-B>\target\frontend\generated-flow-imports.js'
...
Caused by: java.lang.IllegalStateException:
Failed to find the following css files in the 'node_modules' or '/frontend' tree:
- ./styles/inws-styles.css
Check that they exist or are installed.
Where inws-styles.css is a stylesheet in Module-A.
I was able to workaround this by copying the .css file from Module-A into Module-B, but we shouldn’t have to do that. I think this is a bug.
I thought the location of the frontend directory was dependent on how your application was packaged (war vs jar). I can’t find the documentation on this at the moment.
https://github.com/vaadin/flow/issues/6419 has been closed. It was a mis-configuration in my web component’s pom.xml. Basically, the pom.xml should only build the module as a jar. All of the other plugins (vaadin-maven-plugin / jetty) needed to be removed.
No more IllegalStateExceptions when compiling “Module-A”.