Package com.vaadin.flow.plugin.maven
Class BuildFrontendMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.vaadin.flow.plugin.maven.FlowModeAbstractMojo
com.vaadin.flow.plugin.maven.BuildFrontendMojo
- All Implemented Interfaces:
com.vaadin.flow.plugin.base.PluginAdapterBase,com.vaadin.flow.plugin.base.PluginAdapterBuild,org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="build-frontend",
requiresDependencyResolution=COMPILE_PLUS_RUNTIME,
defaultPhase=PREPARE_PACKAGE)
public class BuildFrontendMojo
extends FlowModeAbstractMojo
implements com.vaadin.flow.plugin.base.PluginAdapterBuild
Goal that builds the frontend bundle.
It performs the following actions when creating a package:
- Update
Constants.PACKAGE_JSONfile with theNpmPackageannotations defined in the classpath, - Copy resource files used by flow from `.jar` files to the `node_modules` folder
- Install dependencies by running
npm install - Update the
FrontendUtils.IMPORTS_NAMEfile imports with theJsModuleThemeandJavaScriptannotations defined in the classpath, - Update
FrontendUtils.VITE_CONFIGfile.
- Since:
- 2.0
-
Field Summary
Fields inherited from class com.vaadin.flow.plugin.maven.FlowModeAbstractMojo
INCLUDE_FROM_COMPILE_DEPS_REGEX, productionModeFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckRuntimeDependency(String groupId, String artifactId, Consumer<String> missingDependencyMessage) booleanciBuild()protected booleanDefine if frontend files generated by bundle build should be cleaned or not.booleanprotected voidPerform whatever build-process behavior thisMojoimplements.
This is the main trigger for theMojoinside theMavensystem, and allows theMojoto communicate errors.booleanbooleanbooleanbooleanbooleanMethods inherited from class com.vaadin.flow.plugin.maven.FlowModeAbstractMojo
applicationIdentifier, applicationProperties, buildFolder, bunEnable, eagerServerLoad, execute, frontendDirectory, frontendExtraFileExtensions, frontendOutputDirectory, generatedTsFolder, getClassFinder, getJarFiles, isCommercialBannerEnabled, isDebugEnabled, isFrontendHotdeploy, isFrontendIgnoreVersionChecks, isHillaAvailable, isHillaAvailable, isHillaUsed, isHillaUsed, isJarProject, isNpmExcludeWebComponents, isPrepareFrontendCacheDisabled, isReactEnabled, javaResourceFolder, javaSourceFolder, logDebug, logDebug, logError, logError, logInfo, logWarn, logWarn, nodeDownloadRoot, nodeFolder, nodeVersion, npmFolder, openApiJsonFile, pnpmEnable, postinstallPackages, projectBaseDirectory, requireHomeNodeExec, servletResourceOutputDirectory, skipDevBundleBuild, triggerRefresh, useGlobalPnpm, webpackOutputDirectoryMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.plugin.base.PluginAdapterBase
applicationIdentifier, applicationProperties, buildFolder, bunEnable, createLookup, eagerServerLoad, frontendDirectory, frontendExtraFileExtensions, frontendOutputDirectory, generatedTsFolder, getClassFinder, getJarFiles, isCommercialBannerEnabled, isDebugEnabled, isFrontendHotdeploy, isFrontendIgnoreVersionChecks, isJarProject, isNpmExcludeWebComponents, isPrepareFrontendCacheDisabled, isReactEnabled, javaResourceFolder, javaSourceFolder, logDebug, logDebug, logError, logError, logInfo, logWarn, logWarn, nodeDownloadRoot, nodeFolder, nodeVersion, npmFolder, openApiJsonFile, pnpmEnable, postinstallPackages, projectBaseDirectory, requireHomeNodeExec, servletResourceOutputDirectory, skipDevBundleBuild, useGlobalPnpm, webpackOutputDirectory
-
Constructor Details
-
BuildFrontendMojo
public BuildFrontendMojo()
-
-
Method Details
-
executeInternal
protected void executeInternal() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureExceptionDescription copied from class:FlowModeAbstractMojoPerform whatever build-process behavior thisMojoimplements.
This is the main trigger for theMojoinside theMavensystem, and allows theMojoto communicate errors.- Specified by:
executeInternalin classFlowModeAbstractMojo- 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.
-
cleanFrontendFiles
protected boolean cleanFrontendFiles()Define if frontend files generated by bundle build should be cleaned or not.The targeted frontend files are files that do not exist when build-frontend target is executed.
Extending mojo can override this method to return false so that any frontend files created for the bundle build are not removed.
- Returns:
trueto remove created files,falseto keep files
-
frontendResourcesDirectory
- Specified by:
frontendResourcesDirectoryin interfacecom.vaadin.flow.plugin.base.PluginAdapterBuild
-
generateBundle
public boolean generateBundle()- Specified by:
generateBundlein interfacecom.vaadin.flow.plugin.base.PluginAdapterBuild
-
generateEmbeddableWebComponents
public boolean generateEmbeddableWebComponents()- Specified by:
generateEmbeddableWebComponentsin interfacecom.vaadin.flow.plugin.base.PluginAdapterBuild
-
optimizeBundle
public boolean optimizeBundle()- Specified by:
optimizeBundlein interfacecom.vaadin.flow.plugin.base.PluginAdapterBuild
-
runNpmInstall
public boolean runNpmInstall()- Specified by:
runNpmInstallin interfacecom.vaadin.flow.plugin.base.PluginAdapterBuild
-
ciBuild
public boolean ciBuild()- Specified by:
ciBuildin interfacecom.vaadin.flow.plugin.base.PluginAdapterBuild
-
forceProductionBuild
public boolean forceProductionBuild()- Specified by:
forceProductionBuildin interfacecom.vaadin.flow.plugin.base.PluginAdapterBuild
-
compressBundle
public boolean compressBundle()- Specified by:
compressBundlein interfacecom.vaadin.flow.plugin.base.PluginAdapterBuild
-
resourcesOutputDirectory
- Specified by:
resourcesOutputDirectoryin interfacecom.vaadin.flow.plugin.base.PluginAdapterBuild
-
checkRuntimeDependency
public boolean checkRuntimeDependency(String groupId, String artifactId, Consumer<String> missingDependencyMessage) - Specified by:
checkRuntimeDependencyin interfacecom.vaadin.flow.plugin.base.PluginAdapterBuild
-