Class VaadinFlowPluginExtension
-
- All Implemented Interfaces:
public abstract class VaadinFlowPluginExtension
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classVaadinFlowPluginExtension.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Property<Boolean>productionModeprivate final Property<File>webpackOutputDirectoryprivate final Property<File>frontendOutputDirectoryprivate final Property<File>resourcesOutputDirectoryprivate final Property<File>npmFolderprivate final Property<File>frontendDirectoryprivate final Property<Boolean>generateBundleprivate final Property<Boolean>runNpmInstallprivate final Property<Boolean>generateEmbeddableWebComponentsprivate final Property<File>frontendResourcesDirectoryprivate final Property<Boolean>optimizeBundleprivate final Property<Boolean>pnpmEnableprivate final Property<Boolean>bunEnableprivate final Property<Boolean>useGlobalPnpmprivate final Property<Boolean>requireHomeNodeExecprivate final Property<String>nodeFolderprivate final Property<Boolean>eagerServerLoadprivate final Property<File>applicationPropertiesprivate final Property<File>openApiJsonFileprivate final Property<File>javaSourceFolderprivate final Property<File>javaResourceFolderprivate final Property<File>generatedTsFolderprivate final Property<String>nodeVersionprivate final Property<String>nodeDownloadRootprivate final Property<File>resourceOutputDirectoryprivate final Property<String>projectBuildDirprivate final ListProperty<String>postinstallPackagesprivate final ListProperty<String>excludePostinstallPackagesprivate final ClasspathFilterclasspathFilterprivate final Property<String>sourceSetNameprivate final Property<String>dependencyScopeprivate final Property<String>processResourcesTaskNameprivate final Property<Boolean>frontendHotdeployprivate final Property<Boolean>ciBuildprivate final Property<Boolean>skipDevBundleBuildprivate final Property<Boolean>forceProductionBuildprivate final Property<Boolean>alwaysExecutePrepareFrontendprivate final Property<Boolean>reactEnableprivate final Property<Boolean>cleanFrontendFilesprivate final Property<String>applicationIdentifierprivate final ListProperty<String>frontendExtraFileExtensionsprivate final Property<Boolean>npmExcludeWebComponentsprivate final Property<Boolean>frontendIgnoreVersionChecksprivate final Property<Integer>minimumFrontendPackageAgeDaysprivate final Property<Boolean>commercialWithBannerprivate final PluginEffectiveConfigurationeffectivepublic final static VaadinFlowPluginExtension.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description VaadinFlowPluginExtension(Project project)
-
Method Summary
Modifier and Type Method Description abstract Property<Boolean>getProductionMode()Whether we are running in productionMode or not. abstract Property<File>getWebpackOutputDirectory()The folder where the frontend build tool should output index.js and other generated files. abstract Property<File>getFrontendOutputDirectory()The folder where the frontend build tool should output index.js and other generated files. abstract Property<File>getResourcesOutputDirectory()The folder where the META-INF/resources files are copied. abstract Property<File>getNpmFolder()The folder where package.jsonfile is located.abstract Property<File>getFrontendDirectory()A directory with project's frontend source files. abstract Property<Boolean>getGenerateBundle()Whether to generate a bundle from the project frontend sources or not. abstract Property<Boolean>getRunNpmInstall()Whether to run npm installafter updating dependencies.abstract Property<Boolean>getGenerateEmbeddableWebComponents()Whether to generate embeddable web components from WebComponentExporter inheritors. abstract Property<File>getFrontendResourcesDirectory()Defines the project frontend directory from where resources should be copied from for use with webpack. abstract Property<Boolean>getOptimizeBundle()Whether to use byte code scanner strategy to discover frontend components. abstract Property<Boolean>getPnpmEnable()Instructs to use pnpm for installing npm frontend resources. abstract Property<Boolean>getBunEnable()Instructs to use bun for installing npm frontend resources. abstract Property<Boolean>getUseGlobalPnpm()Whether the globally installed pnpm tool is used. abstract Property<Boolean>getRequireHomeNodeExec()Whether vaadin home node executable usage is forced. abstract Property<String>getNodeFolder()The folder containing the Node.js executable to use. abstract Property<Boolean>getEagerServerLoad()Whether or not insert the initial Uidl object in the bootstrap index.html. abstract Property<File>getApplicationProperties()Application properties file in Spring project. abstract Property<File>getOpenApiJsonFile()Default generated path of the OpenAPI json. abstract Property<File>getJavaSourceFolder()Java source folders for connect scanning. abstract Property<File>getJavaResourceFolder()Java resource folder. abstract Property<File>getGeneratedTsFolder()The folder where flow will put TS API files for client projects. abstract Property<String>getNodeVersion()The node.js version to be used when node. abstract Property<String>getNodeDownloadRoot()Download node.js from this URL. abstract Property<File>getResourceOutputDirectory()Defines the output directory for generated non-served resources, such as the token file. abstract Property<String>getProjectBuildDir()Defines the output folder used by the project. abstract ListProperty<String>getPostinstallPackages()Defines the npm packages to run postinstall for. abstract ListProperty<String>getExcludePostinstallPackages()Defines the npm packages to exclude from running postinstall scripts. final ClasspathFiltergetClasspathFilter()abstract Property<String>getSourceSetName()The name of the SourceSet to scan for Vaadin components - i.e. abstract Property<String>getDependencyScope()The Gradle scope the Vaadin dependencies have been added to. abstract Property<String>getProcessResourcesTaskName()The Gradle task that the vaadinPrepareFrontendtask must run before.abstract Property<Boolean>getFrontendHotdeploy()Parameter to control if frontend development server should be used in development mode or not. abstract Property<Boolean>getCiBuild()Setting this to true will run {@code npm ci} instead of {@code npm install} when using npm. abstract Property<Boolean>getSkipDevBundleBuild()Enable skip of dev bundle rebuild if a dev bundle exists. abstract Property<Boolean>getForceProductionBuild()Setting this to truewill force a build of the production build even if there is a default production bundle that could be used.abstract Property<Boolean>getAlwaysExecutePrepareFrontend()Prevents tracking state of the vaadinPrepareFrontendtask, so that it will re-run every time it is called.abstract Property<Boolean>getReactEnable()abstract Property<Boolean>getCleanFrontendFiles()abstract Property<String>getApplicationIdentifier()abstract ListProperty<String>getFrontendExtraFileExtensions()The list of extra file extensions that are considered project files. abstract Property<Boolean>getNpmExcludeWebComponents()Whether to exclude Vaadin web component npm packages in packages. abstract Property<Boolean>getFrontendIgnoreVersionChecks()Whether to ignore node/npm tool version checks or not. abstract Property<Integer>getMinimumFrontendPackageAgeDays()Minimum age (in days) a frontend (npm) package version must have before npm, pnpm or bun is allowed to install it. abstract Property<Boolean>getCommercialWithBanner()Allows building a version of the application with a commercial banner when commercial components are used without a license key. final PluginEffectiveConfigurationgetEffective()final UnitfilterClasspath(@DelegatesTo(value = ClasspathFilter.class, strategy = 1) Closure<?> block)final UnitfilterClasspath(Action<ClasspathFilter> block)-
-
Method Detail
-
getProductionMode
abstract Property<Boolean> getProductionMode()
Whether we are running in productionMode or not. Defaults to true when run with
bootJarorbootBuildImagetask, otherwise false. Responds to the-Pvaadin.productionModeproperty.
-
getWebpackOutputDirectory
abstract Property<File> getWebpackOutputDirectory()
The folder where the frontend build tool should output index.js and other generated files. Defaults to
nullwhich will use the auto-detected value of resoucesDir of the main SourceSet, usuallybuild/resources/main/META-INF/VAADIN/webapp/.
-
getFrontendOutputDirectory
abstract Property<File> getFrontendOutputDirectory()
The folder where the frontend build tool should output index.js and other generated files. Defaults to
nullwhich will use the auto-detected value of resoucesDir of the main SourceSet, usuallybuild/resources/main/META-INF/VAADIN/webapp/.
-
getResourcesOutputDirectory
abstract Property<File> getResourcesOutputDirectory()
The folder where the META-INF/resources files are copied. Used for finding the StyleSheet referenced css files. Defaults to
nullwhich will use the auto-detected value of resoucesDir of the main SourceSet, usuallybuild/resources/main/META-INF/resources/.
-
getNpmFolder
abstract Property<File> getNpmFolder()
The folder where
package.jsonfile is located. Default is project root dir.
-
getFrontendDirectory
abstract Property<File> getFrontendDirectory()
A directory with project's frontend source files.
Defaults to
frontend
-
getGenerateBundle
abstract Property<Boolean> getGenerateBundle()
Whether to generate a bundle from the project frontend sources or not. Defaults to true.
-
getRunNpmInstall
abstract Property<Boolean> getRunNpmInstall()
Whether to run
npm installafter updating dependencies. Defaults to true.
-
getGenerateEmbeddableWebComponents
abstract Property<Boolean> getGenerateEmbeddableWebComponents()
Whether to generate embeddable web components from WebComponentExporter inheritors. Defaults to true.
-
getFrontendResourcesDirectory
abstract Property<File> getFrontendResourcesDirectory()
Defines the project frontend directory from where resources should be copied from for use with webpack. Defaults to Constants.LOCAL_FRONTEND_RESOURCES_PATH
-
getOptimizeBundle
abstract Property<Boolean> getOptimizeBundle()
Whether to use byte code scanner strategy to discover frontend components. Defaults to true.
-
getPnpmEnable
abstract Property<Boolean> getPnpmEnable()
Instructs to use pnpm for installing npm frontend resources. Default is Constants.ENABLE_PNPM_DEFAULT
pnpm, a.k.a. performant npm, is a better front-end dependency management option. With pnpm, packages are cached locally by default and linked (instead of downloaded) for every project. This results in reduced disk space usage and faster recurring builds when compared to npm.
-
getBunEnable
abstract Property<Boolean> getBunEnable()
Instructs to use bun for installing npm frontend resources. Default is false.
bun, is a better front-end dependency management option. With bun, packages are cached locally by default and linked (instead of downloaded) for every project. This results in reduced disk space usage and faster recurring builds when compared to npm.
-
getUseGlobalPnpm
abstract Property<Boolean> getUseGlobalPnpm()
Whether the globally installed pnpm tool is used. By default, the pinned supported version of pnpm is used, see FrontendTools.DEFAULT_PNPM_VERSION.
-
getRequireHomeNodeExec
abstract Property<Boolean> getRequireHomeNodeExec()
Whether vaadin home node executable usage is forced. If it's set to
truethen vaadin home 'node' is checked and installed if it's absent. Then it will be used instead of globally 'node' or locally installed installed 'node'.Defaults to false.
-
getNodeFolder
abstract Property<String> getNodeFolder()
The folder containing the Node.js executable to use.
When specified, Node.js will be exclusively used from this folder. If the binary is not found, the build will fail with no fallback.
Example: "/usr/local/custom-node" or "C:\custom\node"
Defaults to null (use default node resolution).
-
getEagerServerLoad
abstract Property<Boolean> getEagerServerLoad()
Whether or not insert the initial Uidl object in the bootstrap index.html. Defaults to false. Responds to the
-Pvaadin.eagerServerLoadproperty.
-
getApplicationProperties
abstract Property<File> getApplicationProperties()
Application properties file in Spring project. Defaults to
src/main/resources/application.properties
-
getOpenApiJsonFile
abstract Property<File> getOpenApiJsonFile()
Default generated path of the OpenAPI json.
Defaults to
generated-resources/openapi.json.
-
getJavaSourceFolder
abstract Property<File> getJavaSourceFolder()
Java source folders for connect scanning.
-
getJavaResourceFolder
abstract Property<File> getJavaResourceFolder()
Java resource folder.
-
getGeneratedTsFolder
abstract Property<File> getGeneratedTsFolder()
The folder where flow will put TS API files for client projects.
-
getNodeVersion
abstract Property<String> getNodeVersion()
The node.js version to be used when node.js is installed automatically by Vaadin, for example
"v16.0.0". Defaults to FrontendTools.DEFAULT_NODE_VERSION.
-
getNodeDownloadRoot
abstract Property<String> getNodeDownloadRoot()
Download node.js from this URL. Handy in heavily firewalled corporate environments where the node.js download can be provided from an intranet mirror. Defaults to NodeInstaller.DEFAULT_NODEJS_DOWNLOAD_ROOT.
Example:
"https://nodejs.org/dist/".
-
getResourceOutputDirectory
abstract Property<File> getResourceOutputDirectory()
Defines the output directory for generated non-served resources, such as the token file. Defaults to
build/vaadin-generatedfolder.The plugin will automatically register this as an additional resource folder, which should then be picked up by the IDE. That will allow the app to run for example in Intellij with Tomcat. Generating files into build/resources/main wouldn't work since Intellij+Tomcat ignores that folder.
The
flow-build-info.jsonfile is generated here.
-
getProjectBuildDir
abstract Property<String> getProjectBuildDir()
Defines the output folder used by the project.
Default value is the
project.buildDirand should not need to be changed.
-
getPostinstallPackages
abstract ListProperty<String> getPostinstallPackages()
Defines the npm packages to run postinstall for.
-
getExcludePostinstallPackages
abstract ListProperty<String> getExcludePostinstallPackages()
Defines the npm packages to exclude from running postinstall scripts. Used to skip built-in entries (e.g.
esbuild) when their postinstall step is known to fail or is not needed.
-
getClasspathFilter
final ClasspathFilter getClasspathFilter()
-
getSourceSetName
abstract Property<String> getSourceSetName()
The name of the SourceSet to scan for Vaadin components - i.e. the classes that are annoated with Vaadin annotations.
Defaults to
"main"
-
getDependencyScope
abstract Property<String> getDependencyScope()
The Gradle scope the Vaadin dependencies have been added to. Defaults to 'runtimeClasspath' if no sourceSetName has been specified, or '<code>sourceSetName</code>RuntimeClasspath' if a non-main sourceset has been set.
-
getProcessResourcesTaskName
abstract Property<String> getProcessResourcesTaskName()
The Gradle task that the
vaadinPrepareFrontendtask must run before. The target task should run before or be the task that copies the files from the resources directories of the specified SourceSet to the relevant output directory for that SourceSet. Defaults to 'processResources' if no sourceSetName has been specified, or 'process<code>SourceSetName</code>Resources' if a non-main sourceset has been specified.
-
getFrontendHotdeploy
abstract Property<Boolean> getFrontendHotdeploy()
Parameter to control if frontend development server should be used in development mode or not.
Defaults to false.
-
getCiBuild
abstract Property<Boolean> getCiBuild()
Setting this to true will run {@code npm ci} instead of {@code npm install} when using npm.
If using pnpm, the install will be run with {@code --frozen-lockfile} parameter.
This makes sure that the versions in package lock file will not be overwritten and production builds are reproducible.
-
getSkipDevBundleBuild
abstract Property<Boolean> getSkipDevBundleBuild()
Enable skip of dev bundle rebuild if a dev bundle exists. Defaults to false.
-
getForceProductionBuild
abstract Property<Boolean> getForceProductionBuild()
Setting this to
truewill force a build of the production build even if there is a default production bundle that could be used.Created production bundle optimization is defined by optimizeBundle parameter.
Defaults to
false.
-
getAlwaysExecutePrepareFrontend
abstract Property<Boolean> getAlwaysExecutePrepareFrontend()
Prevents tracking state of the
vaadinPrepareFrontendtask, so that it will re-run every time it is called.Setting this to
trueallows to always executevaadinPrepareFrontend.Defaults to
false, meaning that the task execution is skipped when its outcomes are up-to-date, improving the overall build time.
-
getReactEnable
abstract Property<Boolean> getReactEnable()
-
getCleanFrontendFiles
abstract Property<Boolean> getCleanFrontendFiles()
-
getApplicationIdentifier
abstract Property<String> getApplicationIdentifier()
-
getFrontendExtraFileExtensions
abstract ListProperty<String> getFrontendExtraFileExtensions()
The list of extra file extensions that are considered project files. Hashes are calculated for these files as part of detecting if a new bundle should be generated.
-
getNpmExcludeWebComponents
abstract Property<Boolean> getNpmExcludeWebComponents()
Whether to exclude Vaadin web component npm packages in packages.json
-
getFrontendIgnoreVersionChecks
abstract Property<Boolean> getFrontendIgnoreVersionChecks()
Whether to ignore node/npm tool version checks or not. Defaults to {@code false}.
-
getMinimumFrontendPackageAgeDays
abstract Property<Integer> getMinimumFrontendPackageAgeDays()
Minimum age (in days) a frontend (npm) package version must have before npm, pnpm or bun is allowed to install it. Mitigates supply-chain attacks where a compromised version is briefly available on the registry. Defaults to {@code 0} (disabled); set to a positive value to enable. Requires pnpm >= 10.16.0 or bun >= 1.3.0 when those tools are used.
-
getCommercialWithBanner
abstract Property<Boolean> getCommercialWithBanner()
Allows building a version of the application with a commercial banner when commercial components are used without a license key.
-
getEffective
final PluginEffectiveConfiguration getEffective()
-
filterClasspath
final Unit filterClasspath(@DelegatesTo(value = ClasspathFilter.class, strategy = 1) Closure<?> block)
-
filterClasspath
final Unit filterClasspath(Action<ClasspathFilter> block)
-
-
-
-