0

Update: Bug

I filed Issue ticket # 6,629. Determined there to be a bug, with some details explained.

I leave this Question open in case anyone has a workaround.

tl;dr

Some part of the Vaadin 14 Maven-driven build process is ignoring the <build><directory> setting in my Maven POM file, something to do with:

  • target
    • frontend
      • generated-flow-imports.js
      • package.json

Perhaps I should file a bug-report. Or is there a solution/workaround?

Details

I am using Vaadin 14.0.7 or 14.1.0alpha2 to build some web apps. I would like to use a ramdisk (a.k.a. RAM drive) to speed up the build process, and also to avoid wear-and-tear on my flash storage.

With this Question, I am able to mount a 1 gig ramdisk on macOS Mojave on a Mac mini.

diskutil partitionDisk $(hdiutil attach -nomount ram://2097152) 1 GPTFormat APFS 'RamDisk' '100%'

With this Answer, I edited my Maven POM file to get IntelliJ to build using a target folder on the ramdisk.

  • To the <properties> element add:
    <buildDirectory>/Volumes/RamDisk/target</buildDirectory>
  • To the <build> element, add:
    
<directory>${buildDirectory}</directory>

After running a Maven install, I can see the build succeeded there, with all the expected folders and a WAR file.

The problem comes when I tried to run my project from within IntelliJ using the Jetty server bundled with IntelliJ, by running from the Maven pane the jetty:run item. I saw much of the expected output in the Run pane of IntelliJ. But after much of the webpack lines, I got a Frontend compilation failed error:

[webpack] INFO dev-webpack -                              build/webcomponentsjs/webcomponents-loader.js   6.13 KiB          [emitted]  
[webpack] INFO dev-webpack - 
[webpack] ERROR dev-webpack - ERROR in Entry module not found: Error: Can't resolve '/Volumes/RamDisk/target/frontend/generated-flow-imports.js' in '/Users/basilbourque/IdeaProjects/ticktock/frontend'
[webpack] ERROR dev-webpack - 
[webpack] ERROR dev-webpack - ERROR in Entry module not found: Error: Can't resolve '/Volumes/RamDisk/target/frontend/generated-flow-imports.js' in '/Users/basilbourque/IdeaProjects/ticktock/frontend'
[webpack] ERROR dev-webpack - ℹ 「wdm」: Failed to compile.
[webpack] ERROR dev-webpack - 
------------------ Frontend compilation failed. -----------------

The /Volumes/RamDisk/target/frontend/ folder does exist on the ramdisk. But no generated-flow-imports.js file is found within.

The Vaadin web-app does manage to run on the server. When pointing my web browser to that web app, I can see my expected web page displayed, but mostly covered by a long error message in a box with red text, all about a “Webpack Error”.

On the ramdisk, there is a folder named frontend being created inside the target folder. It contains only a single file, package.json.

Screenshot of ramdisk:

screenshot of folder named "target" on the ramdisk, inside of which one folder is named "frontend" containing a single file <package.json">

Most of the expected stuff appears on the ramdisk in target folder. But on the flash storage, a target folder is being created, with a frontend folder nested inside with a pair of files: generated-flow-imports.js & package.json. So it would seem there is some part of the Vaadin project build that is ignoring the <build><directory> setting in my Maven POM file.

Screenshot of flash storage:

screenshot of what is found on flash storage, in Vaadin web app project folder, showing a folder named target was created, along with a folder named frontend, inside of which are a pair of files (.js & .json)

If I go back to the POM to comment-out my 
<directory>${buildDirectory}</directory>, all is well again, able to run my Vaadin web app via the bundled Jetty without any "frontend" or "webpack" errors.

➥ What can I do to get the frontend-compilation to work with my ramdisk?

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • was there anything generated into the "regular" build folders when you pointed buildDirectory to the ramdrive? im guessing some maven plugin used during the build doesnt respect buildDirectory and may need to be individually configured – radai Oct 04 '19 at 05:40
  • Any reason you just don't copy the whole source tree to your ramdisk and then just work from there? – Thorbjørn Ravn Andersen Oct 04 '19 at 14:13
  • @ThorbjørnRavnAndersen See Wikipedia, [*Kernel panic — macOS*](https://en.wikipedia.org/wiki/Kernel_panic#macOS) – Basil Bourque Oct 04 '19 at 16:26
  • @radai Thanks for asking. Yes, indeed, I checked: Most of the expected stuff appears on the ramdisk in `target` folder. But on the flash storage, a `target` folder is being created, with a `frontend` folder nested inside with a pair of files: `generated-flow-imports.js` & `package.json`. So there is some part of the Vaadin project build that is ignoring the `` setting in my Maven POM file. Perhaps this is sufficient to warrant a bug report. – Basil Bourque Oct 04 '19 at 16:33
  • @BasilBourque - yup, seems like either going over the source for the plugin and/or filing a bug report are the ways forward. have you tried symlinking the target folder in your disk to the ramdrive to try and trick the plugin ?, or you could make maven copy the files over after tha vaadin plugin runs (see the maven ant plugin) – radai Oct 05 '19 at 03:02
  • @BasilBourque are you trying to say you get kernel panics? Then you have more serious problems than ssd wear. – Thorbjørn Ravn Andersen Oct 05 '19 at 09:14
  • @ThorbjørnRavnAndersen No, I’m saying that a ram disk carries an inherent risk of losing all my work, poof, gone. Plus an added chore of having to copy my work on and off the ram disk. Furthermore, Maven has an explicit feature for relocating the build folder, so there should be a way to make this work. – Basil Bourque Oct 05 '19 at 15:38
  • Version control (like git) helps against work loss and is how you easily copy your work on and off the RAM disk. I agree that you found a bug. – Thorbjørn Ravn Andersen Oct 05 '19 at 19:35

0 Answers0