Class FlowLifecycleParticipant

java.lang.Object
org.apache.maven.AbstractMavenLifecycleParticipant
com.vaadin.flow.plugin.maven.FlowLifecycleParticipant

public class FlowLifecycleParticipant extends org.apache.maven.AbstractMavenLifecycleParticipant
Maven lifecycle participant that deletes the production flow-build-info.json token file after each Maven session ends.

This supplements the deleteOnExit() call in BuildFrontendUtil, which only fires on JVM exit and therefore never runs when using the Maven Daemon (mvnd). By hooking into afterSessionEnd(MavenSession), the token file is cleaned up after every build invocation even when the daemon JVM stays alive between builds.

The exact token file path is written into the Maven project properties by BuildFrontendMojo under TOKEN_FILE_PATH_PROPERTY so that a user-configured resourceOutputDirectory is always respected.

This participant is only active when the plugin is declared with <extensions>true</extensions> in the user's pom.xml.

The component is registered via META-INF/plexus/components.xml rather than annotations, since the plexus-component-metadata annotation processor is not part of this build.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Maven project property key under which BuildFrontendMojo stores the absolute path of the token file it wrote.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    afterSessionEnd(org.apache.maven.execution.MavenSession session)
     

    Methods inherited from class org.apache.maven.AbstractMavenLifecycleParticipant

    afterProjectsRead, afterSessionStart

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TOKEN_FILE_PATH_PROPERTY

      public static final String TOKEN_FILE_PATH_PROPERTY
      Maven project property key under which BuildFrontendMojo stores the absolute path of the token file it wrote. Read by afterSessionEnd(MavenSession) to delete the correct file.
      See Also:
  • Constructor Details

    • FlowLifecycleParticipant

      public FlowLifecycleParticipant()
  • Method Details

    • afterSessionEnd

      public void afterSessionEnd(org.apache.maven.execution.MavenSession session)
      Overrides:
      afterSessionEnd in class org.apache.maven.AbstractMavenLifecycleParticipant