Skip to content
49 changes: 43 additions & 6 deletions articles/flow/configuration/development-mode/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,49 @@ Development mode is designed to make it easier to build applications. Changes yo

The amount of data sent when in Development mode, though, is not optimized to be small. Conversely, <<{articles}/flow/production#, Production mode>> sends as little data as possible to the end user's browser. It optimizes performance wherever possible. In this mode, no development tools are used, and debugging information is disabled.

Development mode is opt-in feature. To enable it, add following dependency to your build configuration:

[.example]
--
[source,xml]
----
<source-info group="Maven"></source-info>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-dev</artifactId>

<!-- Add optional=true if same Maven project build or profile has
vaadin-maven-plugin configured with build-frontend goal. This ensures
that vaadin-dev dependencies are excluded from the production package.
-->
<optional>true</optional>
</dependency>
----

[source,groovy]
----
<source-info group="Gradle"></source-info>
// In general, enable by adding vaadin-dev in dependencies.
dependencies {
implementation('com.vaadin:vaadin-dev')
}


// For production configurations, add vaadin-dev dependency only
// for runtimeClasspath.
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}

dependencies {
developmentOnly('com.vaadin:vaadin-dev')
}

----
--

== Development Mode Methods

Expand Down Expand Up @@ -178,10 +221,6 @@ Here's an example that excludes both professional and core components by adding
<groupId>com.vaadin</groupId>
<artifactId>vaadin-core-components</artifactId>
</exclusion>
<exclusion>
<groupId>com.vaadin</groupId>
<artifactId>copilot</artifactId>
</exclusion>
<exclusion>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-icons-flow</artifactId>
Expand All @@ -190,8 +229,6 @@ Here's an example that excludes both professional and core components by adding
</dependency>
----

Also, `copilot` is excluded. This is recommended because Copilot depends on core components and won't work without them.

Vaadin's Lumo theme isn't excluded. `vaadin-icons-flow` is excluded in the example because it's otherwise included by Lumo theme dependency. To also exclude theme, add `vaadin-lumo-theme` exclusions and use <<../../../styling/advanced/disabling-default-theme.adoc#,NoTheme annotation>> to disable the default theme.

Set `vaadin.npm.excludeWebComponents` <<../properties.adoc#,configuration property>> to `true` to exclude professional and core components, including `hilla-auto-crud`, from [filename]`package.json`. Lumo theme is not excluded.
Expand Down
4 changes: 2 additions & 2 deletions articles/flow/production/native.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ With the annotation, it works as expected. Without it, you would get an empty gr
Compile your Vaadin application into a native image using Maven by executing the following command in the project root directory:

[source,bash]
mvn -Pproduction -Pnative native:compile
mvn -Pnative native:compile

This command compiles the application with the production and native profiles enabled. The native profile instructs Maven to use the GraalVM native image compiler for the compilation process.
This command compiles the application with the native profile enabled. The native profile instructs Maven to use the GraalVM native image compiler for the compilation process.

Now run the application. The compilation creates the native image in the target directory. To run it, execute the following command:

Expand Down
38 changes: 4 additions & 34 deletions articles/flow/production/production-build.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@ order: 10

= Production Build

To create a production build, run the following from the command-line for application using Spring Boot:
To create a production build, run the following from the command-line:

[source,terminal]
----
mvn clean package
----

For other applications, e.g., Jakarta EE or plain Java, and for better backwards compatibility, run same with a production profile:

[source,terminal]
----
mvn clean package -Pproduction
----

Executing this line builds a `JAR` or `WAR` file, with all of the dependencies and bundled frontend resources, ready to be deployed. You can find the file in the `target` folder after the build is finished.

If no add-ons or frontend files are used in the application, the previous command uses a pre-compiled production bundle to eliminate the need to run frontend tools like `npm` and Vite. However, frontend tools are still used to generate an application-specific bundle in the following situations:
Expand Down Expand Up @@ -177,34 +170,11 @@ If you're using a 64-bit operating system, be sure to use a 64-bit JDK installat

== Excluding Development Server Module

The Vite server integration and live reload features -- which are available only in development builds -- are contained in the `com.vaadin:vaadin-dev-server` module. You should exclude this module when building a production application. You can do this by adding the following dependency exclusion to the `<dependencies>` section in the `production` profile:
The Vite server integration and live reload features -- available only in development builds -- are provided by the `com.vaadin:vaadin-dev-server` module, which is included in the `vaadin-dev` module.

.`pom.xml`
[source,xml]
----
<profiles>
<profile>
<id>production</id>

<!-- above production build configuration -->

<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<exclusions>
<exclusion>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-dev</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
</profiles>
----
When you use `vaadin-dev` in your Maven configuration to run in development mode -- within the same Maven profile or project dependencies -- you should exclude this module from the production package.

Or when building Spring Boot 4 application, add `vaadin-dev` dependency as a `optional` scope in project `<dependencies>`. Spring Boot 4 `spring-boot-maven-plugin` automatically excludes optional dependencies from the final build:
You can do this by declaring the `vaadin-dev` dependency `optional` in your project `<dependencies>`. Maven automatically excludes optional dependencies from the final production package:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no changes to https://vaadin.com/docs/v25/flow/configuration/development-mode, but I think we need to instruct devs how to configure development config according to the new approach.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated development-mode page. And added link from upgrade guide.


.`pom.xml`
[source,xml]
Expand Down
4 changes: 2 additions & 2 deletions articles/hilla/guides/production/native.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ To compile your Hilla application into a native image, follow these steps:
. *Compile your application* using Maven by executing the following command in the project root directory:
+
[source,bash]
mvn -Pproduction -Pnative native:compile
mvn -Pnative native:compile
+
This command compiles your application with the production and native profiles enabled. The native profile instructs Maven to use the GraalVM native image compiler for the compilation process.
This command compiles your application with the native profile enabled. The native profile instructs Maven to use the GraalVM native image compiler for the compilation process.

. *Run the application*. The compilation creates the native image in the target directory. To run the application, execute the following command:
+
Expand Down
4 changes: 2 additions & 2 deletions articles/hilla/lit/guides/production/native.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ To compile your Hilla application into a native image, follow these steps:
. *Compile your application* using Maven by executing the following command in the project root directory:
+
[source,bash]
mvn -Pproduction -Pnative native:compile
mvn -Pnative native:compile
+
This command compiles your application with the production and native profiles enabled. The native profile instructs Maven to use the GraalVM native image compiler for the compilation process.
This command compiles your application with the native profile enabled. The native profile instructs Maven to use the GraalVM native image compiler for the compilation process.

. *Run the application*. The compilation creates the native image in the target directory. To run the application, execute the following command:
+
Expand Down
29 changes: 28 additions & 1 deletion articles/upgrading/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,35 @@ If you're using a Gradle wrapper, update it to version 8.14 by executing the fol

For Java 21 compatibility, you may need to update the `sourceCompatibility` setting in your project's build file to version 21. Check your project's build file and make any necessary changes.

== Development Tools

Development tools are opt-in feature in Vaadin 25. `vaadin-dev` module isn't included transitively by default anymore via `vaadin` or `vaadin-core` or any other Vaadin dependencies. To include it, add following dependency to your build configuration:

[.example]
--
[source,xml]
----
<source-info group="Maven"></source-info>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-dev</artifactId>
<optional>true</optional>
</dependency>
----

[source,groovy]
----
<source-info group="Gradle"></source-info>
dependencies {
implementation('com.vaadin:vaadin-dev')
}
----
--

More detailed instructions can be found in <<{articles}/flow/configuration/development-mode#development-mode, Development Mode>>.

== Hilla
Vaadin Spring Boot Starter no longer includes Hilla by default. In case you have react views, add `hilla-spring-boot-starter` to work together with `hilla-spring-boot-starter` in your build configuration.
Vaadin Spring Boot Starter no longer includes Hilla by default. In case you have react views, add `hilla-spring-boot-starter` to work together with `vaadin-spring-boot-starter` in your build configuration.

.pom.xml
[source,xml]
Expand Down
Loading