Skip to content

build-frontend execution should not be overridden on server run #13349

Closed

Description

@caalador

Description of the bug

If configuring a project to execute prepare-frontend and build-frontend to generate a production build the application will fail to run correctly when executing mvn jetty:run or mvn spring-boot:run.

This is due to the fact that the run target will after the normal build also invoke the execution of the lifecycle phase test-compile prior to executing leading to prepare-frontend running a second time overriding the flow-build-info.json from the build-frontend execution.

In the starter projects this has been circumvented by running both goals in the compile phase.

for reference see #13332

Expected behavior

prepare-frontend is not executed alone or a second time, overriding the flow-build-info.json and making the production build start the dev server.

Minimal reproducible example

  • Get a HelloWorld application from start and remove the <phase>compile</phase> from the production profile in the pom.
  • Run project with mvn spring-boot:run -Pproduction
  • Check that target\classes\META-INF\VAADIN\config\flow-build-info.json doesn't contain fallback modules and that target\frontend\generated-flow-imports.js doesn't contain all components while target\frontend\generated-flow-imports-fallback.js exists.

For a visual example:

  • Get a HelloWorld application from start and remove the <phase>compile</phase> from the production profile in the pom.
  • change the TextField name into Component name and initialize it in the as name = (Component)Class.forName("com.vaadin.flow.component.textfield.TextField").newInstance(); and remove notification show.
  • Run project with mvn spring-boot:run -Pproduction
  • See that text field is not rendered

Versions

  • Vaadin / Flow version: 14+
  • Application Server (if applicable): maven server plugin for jetty + spring-boot

Activity

  1. self-assigned this
    on Mar 25, 2022
  2. added a commit that references this issue on Mar 25, 2022
    e3d114d
  3. added a commit that references this issue on Mar 28, 2022
    f072290
  4. added 3 commits that reference this issue on Mar 28, 2022
    30de827
    ed3ee43
    4b7c4d4
  5. added a commit that references this issue on Mar 30, 2022
    c353420
  6. vaadin-bot commented on Apr 5, 2022

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with Vaadin 22.0.12.

  7. vaadin-bot commented on Apr 5, 2022

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with Vaadin 23.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions