Table of contents
1.
Introduction
2.
Maven configuration properties plugin
3.
Plugin configuration options
3.1.
Application Properties
3.2.
eagerServerLoad
3.3.
frontend directory
3.4.
generated folder
3.5.
Generated Ts Folder
3.6.
Java source folder
3.7.
Java resource folder
3.8.
Node Download Root
3.9.
node version
3.10.
nodeAutoUpdate
3.11.
npmFolder
3.12.
openApiJsonFile
3.13.
pnpm Allow
3.14.
useGlobalPnpm
3.15.
production mode
3.16.
project base dir
3.17.
requireHomeNodeExec
3.18.
resource OutputDirectory
3.19.
useDeprecatedV14Bootstrapping
3.20.
webpackOutputDirectory
3.21.
project build dir
4.
Build front-end goal parameters     
4.1.
Generate Bundle
4.2.
Run Npm Install
4.3.
Generate Embeddable Web Components
4.4.
Optimize Bundle
5.
Frequently Asked Questions
5.1.
What do Maven properties mean?
5.2.
How do I configure Maven's system properties?
5.3.
In a Maven project, where is the application properties file?
6.
Conclusion
Last Updated: Mar 27, 2024
Medium

Maven Configuration Properties

Author Ashish Sharma
0 upvote

Introduction

In this article, we will discuss the introduction to Maven configuration properties, maven configuration properties plugin, plugin configuration options, front end goal parameters. The majority of customizable properties are configured through the Vaadin Maven plugin. These can be configured either as system attributes or as plugin configuration options. Now let's discuss the maven configuration plugins with an example.     

maven description

Maven configuration properties plugin

The plugin is the ideal place to set persistent configuration properties for a Maven project.

 

//code to show the maven configuration properties plugin
<plugin>
    <groupId>maven configuration properties</groupId>
    <artifactId>vaadin-maven-plugin</artifactId>
    <version>${vaadin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>prepare-frontend</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <nodeAutoUpdate>true</nodeAutoUpdate>
    </configuration>
</plugin>

Plugin configuration options

All maven configuration properties are listed below along with their default settings:                  

Application Properties

a Spring project's application.properties file's location. /src/main/resources/application.properties under the $project.basedir directory by default.

eagerServerLoad

if the bootstrap index.html should include the first UIDL object. False is the default.

frontend directory

the folder containing the front-end source code for the project. "$project.basedir/frontend" is the default value.

generated folder

the location of the folder where Webpack will find created files from Flow. "$project.build.directory/frontend" is the default.

Generated Ts Folder

the location of the TypeScript API files for client projects in Flow. "$project.basedir/frontend/generated" is the default.

Java source folder

"$project.basedir/src/main/java" is the default value.

Java resource folder

 "$project.basedir/src/main/resources" is the default value.

Node Download Root

Use the nodeDownloadRoot URL to download Node.js. An intranet mirror can be used to serve the Node.js download in environments that are protected by a firewall. Node.js will be downloaded from https://nodejs.org/dist/ if the default value is null.

node version

When Node.js is installed automatically, this version should be utilized. The format must be "v16.0.0". Usually uses FrontendTools. DEFAULT NODE VERSION.

nodeAutoUpdate

If the Node.js version present in /.vaadin is older than the defined or default node version, this flag will enable automated updating of that version. Note that any installed version below (now 8.9) should function regardless of this option. False is the default.

npmFolder

the directory containing the package.json file. is set to $project.basedir by default.

openApiJsonFile

openApiJsonFile OpenAPI JSON's default-generated path. opens to the file $project.build.directory/generated-resources/openapi.json by default.

pnpm Allow

specifies that npm front-end resources should be installed via pnpm. Usually sets to true.

useGlobalPnpm

specifies whether to use the version of pnpm that is by default supported or the tool that is globally installed. False is the default.

production mode

Check to see if the program is in production mode. False is the default. According to the instructions in Deploying to Production, the front end is optimized and transpired for older browsers for production.

project base dir

the directory containing the package.json file. is set to $project.basedir by default.

requireHomeNodeExec

how compelled Vaadin home node executable use is. The Vaadin home "node" is checked if it is set to true and installed if it is not. Then, rather than using a locally or globally deployed "node," this is utilized. False is the default.

resource OutputDirectory

resourceOutputDirectory specifies where created unserved resources, like the token file, are output. Vaadin-generated is the default value for $project.build.outputDirectory.

useDeprecatedV14Bootstrapping

Whether or not the legacy V14 bootstrap mode is active. False is the default.

webpackOutputDirectory

the destination folder for index.js and any created files from webpack. defaults to /META-IND/VAADIN/webapp/ in $project.build.outputDirectory.

project build dir

project build dir is the project's build directory. is set to $project.build.directory by default.

Build front-end goal parameters     

types of front end goal parameters

The build-frontend objective also uses the following parameters.

Generate Bundle

if the project front-end sources should be used to create a bundle. Usually sets to true.

Run Npm Install

if the npm install step should be executed after upgrading dependencies. In the event that appears to be up to date, this may not always carry out an npm install. Usually sets to true.

Generate Embeddable Web Components

Whether to produce WebComponentExporter inheritors as embeddable web components. Usually sets to true.

The project front-end directory specified by frontendResourcesDirectory is where resources should be copied for usage with Webpack. /src/main/resources/META-INF/resources/frontend is the default location for this resource.

Optimize Bundle

Whether to find front-end components using a byte code scanner method. Usually sets to true.

Frequently Asked Questions

What do Maven properties mean?

Like properties in Ant, Maven properties are value placeholders. Notation $X, where X is the property, can be used to obtain their values anywhere within a POM. Alternatively, plugins may utilize them as default values, such as: In your situation, you declared the properties as a Java version.

How do I configure Maven's system properties?

You only need to set up the Maven Surefire plugin and use the -Dsystemproperty=propertyvalue flag in the command line to supply System Properties to the tests from the command line. Using Maven, run a single test: MessageUtilTest#msg add test -Dmy message=$ mvn test Greetings, Developer!

In a Maven project, where is the application properties file?

The application's properties file must be added to your classpath. Put the file in src/main/resources if you're using Maven or Gradle. Put that in your src folder if you aren't using Maven or any other build tools, and everything should work out.

Conclusion

In this article, we have extensively discussed the introduction to Maven configuration properties, maven configuration properties plugin, plugin configuration options, front end goal parameters.

After reading about Maven Configuration Properties, are you not feeling excited to read/explore more articles on the topic of file systems? Don't worry; Coding Ninjas has you covered. If you want to check out articles related to maven configuration properties refer to these links, GWT vs Vaadin, Vaadin-Grid, Vaadin-Combo Box, Vaadin-Environment Setup, Vaadin-Confirm Dialog.

Recommended Readings:

NPX vs NPM

Refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive ProgrammingJavaScriptSystem Design, and many more! If you want to test your competency in coding, you may check out the mock test series and participate in the contests hosted on Coding Ninjas Studio! But suppose you have just started your learning process and are looking for questions asked by tech giants like Amazon, Microsoft, Uber, etc. In that case, you must look at the problemsinterview experiences, and interview bundle for placement preparations.

Nevertheless, you may consider our paid courses to give your career an edge over others!

Do upvote our blogs if you find them helpful and engaging!

Happy Learning!

Live masterclass