flow icon indicating copy to clipboard operation
flow copied to clipboard

vaadin.whitelisted-packages should have a sensible default

Open marcushellberg opened this issue 2 years ago • 7 comments

Description of the bug

When downloading a project from start.spring.io, it does not have the vaadin.whitelisted-packages property defined.

Building a native image out of the app and running it fails.

Expected behavior

The app works out of the box also when compiled to native.

We should be able to produce the default value com.vaadin,org.vaadin,dev.hilla,com.example.application easily as a fallback as the first packages are our own, and the last might be determined by finding where the application class is located.

Minimal reproducible example

  • Download an app with the Vaadin dependency from start.spring.io.
  • Native compile it with mvn -Pnative -Pproduction native:compile
  • Run the created binary

Versions

  • Vaadin / Flow version: 24.0
  • Java version: 17, GraalVM
  • OS version: Mac

marcushellberg avatar May 24 '23 19:05 marcushellberg

If start.spring.io is the main concern, then we should probably add com.example.demo.

tarekoraby avatar May 25 '23 06:05 tarekoraby

People can change that. Could we add the package that contains the main spring boot application instead? That should most often be correct.

marcushellberg avatar May 25 '23 15:05 marcushellberg

Sounds reasonable to me. Though that might not be the desired setup in some of the larger projects, this solution would ensure that most new evaluators have a setup that works.

tarekoraby avatar May 26 '23 07:05 tarekoraby

Agreed. If there's an explicit value defined as a property, that should override. But this way, most (all?) projects from both start.vaadin.com and start.spring.io would work out of the box

marcushellberg avatar May 26 '23 16:05 marcushellberg

Needs to be reproduced and see what's the original error we have when building with native profile.

mshabarov avatar May 30 '23 10:05 mshabarov

Projects created with start.vaadin.com currently have vaadin.whitelisted-packages set. I tried to remove it, but I cannot see any error; the application works out of the box

mcollovati avatar Jan 26 '24 14:01 mcollovati

Trying to run the executable produced by the skeleton project fails, but the error seems more related to PWA and AWT than the whitelisted-packages setting. If I remove the PWA annotation, the native executable works fine.

@marcushellberg any chance that you remember the exact error you got? Or could you reproduce it again and post the log with the evidence of the error?

mcollovati avatar Jan 29 '24 11:01 mcollovati