Vaadin 14 - Trouble Compiling Multi-Module Project with Maven

Hello, all. I’m running into a wall with this.

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 {
-src/main/resources
	- META-INF/
		- resources/
			- frontend/
				- styles/
					- inws-styles.css

Any advice would be greatly appreciated. Thanks for your time!

Bryan

17818916.txt (32.6 KB)

To reiterate, the error is:

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.

Bryan

Hi,

you should create a ticket, if you haven’t already: https://github.com/vaadin/flow/issues

-Olli

Olli,

Thanks for the reply. I opened up a ticket for this:

https://github.com/vaadin/flow/issues/6419

Thanks,

Bryan

In had a similar error with my gradle multi module project: [–> Forum Entry]
(https://vaadin.com/forum/thread/17825933/failed-to-find-the-following-css-files-in-the-node_modules-or-fronten)

I was able to solve this problem by moving my frontend folder to the root of the project and NOT the root of the vaadin module

- myproject\
	- frontend\styles\inws-styles.css
	- module1\...
	- module2\...
	- vaadinModule\...

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”.

Bryan