Class FlowModeAbstractMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.vaadin.flow.plugin.maven.FlowModeAbstractMojo
All Implemented Interfaces:
PluginAdapterBase, org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
BuildFrontendMojo, CleanFrontendMojo, ConvertPolymerMojo, GenerateNpmBOMMojo, PrepareFrontendMojo

public abstract class FlowModeAbstractMojo extends org.apache.maven.plugin.AbstractMojo implements PluginAdapterBase
The base class of Flow Mojos in order to compute correctly the modes.
Since:
2.0
  • Field Details

    • INCLUDE_FROM_COMPILE_DEPS_REGEX

      public static final String INCLUDE_FROM_COMPILE_DEPS_REGEX
      Additionally include compile-time-only dependencies matching the pattern.
      See Also:
    • productionMode

      @Parameter(defaultValue="${null}") protected Boolean productionMode
      Whether or not we are running in productionMode.
  • Constructor Details

    • FlowModeAbstractMojo

      public FlowModeAbstractMojo()
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Specified by:
      execute in interface org.apache.maven.plugin.Mojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • executeInternal

      protected abstract void executeInternal() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Perform whatever build-process behavior this Mojo implements.
      This is the main trigger for the Mojo inside the Maven system, and allows the Mojo to communicate errors.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if an unexpected problem occurs. Throwing this exception causes a "BUILD ERROR" message to be displayed.
      org.apache.maven.plugin.MojoFailureException - if an expected problem (such as a compilation failure) occurs. Throwing this exception causes a "BUILD FAILURE" message to be displayed.
    • triggerRefresh

      protected void triggerRefresh(File file)
      Indicates that the file or folder content has been modified during the build.
      Parameters:
      file - a File object.
    • getClasspathElements

      @Deprecated(forRemoval=true) public static List<String> getClasspathElements(org.apache.maven.project.MavenProject project)
      Deprecated, for removal: This API element is subject to removal in a future version.
      will be removed without replacement.
      Generates a List of ClasspathElements (Run and CompileTime) from a MavenProject.
      Parameters:
      project - a given MavenProject
      Returns:
      List of ClasspathElements
    • isHillaAvailable

      public boolean isHillaAvailable()
      Checks if Hilla is available based on the Maven project's classpath.
      Returns:
      true if Hilla is available, false otherwise
    • isHillaAvailable

      public static boolean isHillaAvailable(org.apache.maven.project.MavenProject mavenProject)
      Checks if Hilla is available based on the Maven project's classpath.
      Parameters:
      mavenProject - Target Maven project
      Returns:
      true if Hilla is available, false otherwise
    • isHillaUsed

      public boolean isHillaUsed(File frontendDirectory)
      Checks if Hilla is available and Hilla views are used in the Maven project based on what is in routes.ts or routes.tsx file.
      Parameters:
      frontendDirectory - Target frontend directory.
      Returns:
      true if Hilla is available and Hilla views are used, false otherwise
    • isHillaUsed

      public static boolean isHillaUsed(org.apache.maven.project.MavenProject mavenProject, File frontendDirectory)
      Checks if Hilla is available and Hilla views are used in the Maven project based on what is in routes.ts or routes.tsx file.
      Parameters:
      mavenProject - Target Maven project
      frontendDirectory - Target frontend directory.
      Returns:
      true if Hilla is available and Hilla views are used, false otherwise
    • applicationProperties

      public File applicationProperties()
      Specified by:
      applicationProperties in interface PluginAdapterBase
    • eagerServerLoad

      public boolean eagerServerLoad()
      Specified by:
      eagerServerLoad in interface PluginAdapterBase
    • frontendDirectory

      public File frontendDirectory()
      Specified by:
      frontendDirectory in interface PluginAdapterBase
    • generatedTsFolder

      public File generatedTsFolder()
      Specified by:
      generatedTsFolder in interface PluginAdapterBase
    • getClassFinder

      public com.vaadin.flow.server.frontend.scanner.ClassFinder getClassFinder()
      Specified by:
      getClassFinder in interface PluginAdapterBase
    • getJarFiles

      public Set<File> getJarFiles()
      Specified by:
      getJarFiles in interface PluginAdapterBase
    • isDebugEnabled

      public boolean isDebugEnabled()
      Specified by:
      isDebugEnabled in interface PluginAdapterBase
    • javaSourceFolder

      public File javaSourceFolder()
      Specified by:
      javaSourceFolder in interface PluginAdapterBase
    • javaResourceFolder

      public File javaResourceFolder()
      Specified by:
      javaResourceFolder in interface PluginAdapterBase
    • logDebug

      public void logDebug(CharSequence debugMessage)
      Specified by:
      logDebug in interface PluginAdapterBase
    • logDebug

      public void logDebug(CharSequence debugMessage, Throwable e)
      Specified by:
      logDebug in interface PluginAdapterBase
    • logInfo

      public void logInfo(CharSequence infoMessage)
      Specified by:
      logInfo in interface PluginAdapterBase
    • logWarn

      public void logWarn(CharSequence warning)
      Specified by:
      logWarn in interface PluginAdapterBase
    • logError

      public void logError(CharSequence error)
      Specified by:
      logError in interface PluginAdapterBase
    • logWarn

      public void logWarn(CharSequence warning, Throwable e)
      Specified by:
      logWarn in interface PluginAdapterBase
    • logError

      public void logError(CharSequence error, Throwable e)
      Specified by:
      logError in interface PluginAdapterBase
    • nodeDownloadRoot

      public URI nodeDownloadRoot() throws URISyntaxException
      Specified by:
      nodeDownloadRoot in interface PluginAdapterBase
      Throws:
      URISyntaxException
    • nodeAutoUpdate

      public boolean nodeAutoUpdate()
      Specified by:
      nodeAutoUpdate in interface PluginAdapterBase
    • nodeVersion

      public String nodeVersion()
      Specified by:
      nodeVersion in interface PluginAdapterBase
    • npmFolder

      public File npmFolder()
      Specified by:
      npmFolder in interface PluginAdapterBase
    • openApiJsonFile

      public File openApiJsonFile()
      Specified by:
      openApiJsonFile in interface PluginAdapterBase
    • pnpmEnable

      public boolean pnpmEnable()
      Specified by:
      pnpmEnable in interface PluginAdapterBase
    • bunEnable

      public boolean bunEnable()
      Specified by:
      bunEnable in interface PluginAdapterBase
    • useGlobalPnpm

      public boolean useGlobalPnpm()
      Specified by:
      useGlobalPnpm in interface PluginAdapterBase
    • projectBaseDirectory

      public Path projectBaseDirectory()
      Specified by:
      projectBaseDirectory in interface PluginAdapterBase
    • requireHomeNodeExec

      public boolean requireHomeNodeExec()
      Specified by:
      requireHomeNodeExec in interface PluginAdapterBase
    • servletResourceOutputDirectory

      public File servletResourceOutputDirectory()
      Specified by:
      servletResourceOutputDirectory in interface PluginAdapterBase
    • webpackOutputDirectory

      public File webpackOutputDirectory()
      Specified by:
      webpackOutputDirectory in interface PluginAdapterBase
    • isJarProject

      public boolean isJarProject()
      Specified by:
      isJarProject in interface PluginAdapterBase
    • buildFolder

      public String buildFolder()
      Specified by:
      buildFolder in interface PluginAdapterBase
    • postinstallPackages

      public List<String> postinstallPackages()
      Specified by:
      postinstallPackages in interface PluginAdapterBase
    • isFrontendHotdeploy

      public boolean isFrontendHotdeploy()
      Specified by:
      isFrontendHotdeploy in interface PluginAdapterBase
    • skipDevBundleBuild

      public boolean skipDevBundleBuild()
      Specified by:
      skipDevBundleBuild in interface PluginAdapterBase
    • isPrepareFrontendCacheDisabled

      public boolean isPrepareFrontendCacheDisabled()
      Specified by:
      isPrepareFrontendCacheDisabled in interface PluginAdapterBase
    • isReactEnabled

      public boolean isReactEnabled()
      Specified by:
      isReactEnabled in interface PluginAdapterBase