diff --git a/flow-plugins/flow-maven-plugin/src/main/java/com/vaadin/flow/plugin/maven/FlowModeAbstractMojo.java b/flow-plugins/flow-maven-plugin/src/main/java/com/vaadin/flow/plugin/maven/FlowModeAbstractMojo.java index 3e977f66064..55b1a2711c2 100644 --- a/flow-plugins/flow-maven-plugin/src/main/java/com/vaadin/flow/plugin/maven/FlowModeAbstractMojo.java +++ b/flow-plugins/flow-maven-plugin/src/main/java/com/vaadin/flow/plugin/maven/FlowModeAbstractMojo.java @@ -109,7 +109,7 @@ public abstract class FlowModeAbstractMojo extends AbstractMojo *
* Example:"https://nodejs.org/dist/"
.
*/
- @Parameter(property = "node.download.root", defaultValue = NodeInstaller.DEFAULT_NODEJS_DOWNLOAD_ROOT)
+ @Parameter(property = InitParameters.NODE_DOWNLOAD_ROOT, defaultValue = NodeInstaller.DEFAULT_NODEJS_DOWNLOAD_ROOT)
private String nodeDownloadRoot;
/**
@@ -117,7 +117,7 @@ public abstract class FlowModeAbstractMojo extends AbstractMojo
* Vaadin, for example `"v16.0.0"`. Defaults to null which uses the
* Vaadin-default node version - see {@link FrontendTools} for details.
*/
- @Parameter(property = "node.version", defaultValue = FrontendTools.DEFAULT_NODE_VERSION)
+ @Parameter(property = InitParameters.NODE_VERSION, defaultValue = FrontendTools.DEFAULT_NODE_VERSION)
private String nodeVersion;
/**
diff --git a/flow-plugins/flow-plugin-base/src/main/java/com/vaadin/flow/plugin/base/BuildFrontendUtil.java b/flow-plugins/flow-plugin-base/src/main/java/com/vaadin/flow/plugin/base/BuildFrontendUtil.java
index 106d66ed38a..5a31f76380a 100644
--- a/flow-plugins/flow-plugin-base/src/main/java/com/vaadin/flow/plugin/base/BuildFrontendUtil.java
+++ b/flow-plugins/flow-plugin-base/src/main/java/com/vaadin/flow/plugin/base/BuildFrontendUtil.java
@@ -58,6 +58,8 @@
import static com.vaadin.flow.server.Constants.GENERATED_TOKEN;
import static com.vaadin.flow.server.Constants.NPM_TOKEN;
import static com.vaadin.flow.server.Constants.PROJECT_FRONTEND_GENERATED_DIR_TOKEN;
+import static com.vaadin.flow.server.InitParameters.NODE_DOWNLOAD_ROOT;
+import static com.vaadin.flow.server.InitParameters.NODE_VERSION;
import static com.vaadin.flow.server.InitParameters.SERVLET_PARAMETER_ENABLE_DEV_SERVER;
import static com.vaadin.flow.server.InitParameters.SERVLET_PARAMETER_INITIAL_UIDL;
import static com.vaadin.flow.server.InitParameters.SERVLET_PARAMETER_PRODUCTION_MODE;
@@ -194,7 +196,8 @@ private static FrontendToolsSettings getFrontendToolsSettings(
* - the PluginAdapterBase.
* @return the Token {@link File}.
*/
- public static File propagateBuildInfo(PluginAdapterBase adapter) {
+ public static File propagateBuildInfo(PluginAdapterBase adapter)
+ throws URISyntaxException {
// For forked processes not accessing to System.properties we leave a
// token file with the information about the build
@@ -208,6 +211,8 @@ public static File propagateBuildInfo(PluginAdapterBase adapter) {
buildInfo.put(SERVLET_PARAMETER_INITIAL_UIDL,
adapter.eagerServerLoad());
buildInfo.put(NPM_TOKEN, adapter.npmFolder().getAbsolutePath());
+ buildInfo.put(NODE_VERSION, adapter.nodeVersion());
+ buildInfo.put(NODE_DOWNLOAD_ROOT, adapter.nodeDownloadRoot().toString());
buildInfo.put(GENERATED_TOKEN,
adapter.generatedFolder().getAbsolutePath());
buildInfo.put(FRONTEND_TOKEN,
@@ -462,6 +467,8 @@ public static void updateBuildFile(PluginAdapterBuild adapter) {
JsonObject buildInfo = JsonUtil.parse(json);
buildInfo.remove(NPM_TOKEN);
+ buildInfo.remove(NODE_VERSION);
+ buildInfo.remove(NODE_DOWNLOAD_ROOT);
buildInfo.remove(GENERATED_TOKEN);
buildInfo.remove(FRONTEND_TOKEN);
buildInfo.remove(Constants.SERVLET_PARAMETER_ENABLE_PNPM);
diff --git a/flow-server/src/main/java/com/vaadin/flow/server/InitParameters.java b/flow-server/src/main/java/com/vaadin/flow/server/InitParameters.java
index 99022b402c1..2979ac1b1d5 100644
--- a/flow-server/src/main/java/com/vaadin/flow/server/InitParameters.java
+++ b/flow-server/src/main/java/com/vaadin/flow/server/InitParameters.java
@@ -63,6 +63,8 @@ public class InitParameters implements Serializable {
public static final String SERVLET_PARAMETER_MAX_MESSAGE_SUSPEND_TIMEOUT = "maxMessageSuspendTimeout";
public static final String SERVLET_PARAMETER_JSBUNDLE = "module.bundle";
public static final String SERVLET_PARAMETER_POLYFILLS = "module.polyfills";
+ public static final String NODE_VERSION = "node.version";
+ public static final String NODE_DOWNLOAD_ROOT = "node.download.root";
/**
* Configuration name for the parameter that determines whether Brotli
diff --git a/flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendTools.java b/flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendTools.java
index 5b148ec3f05..4a37f9e5708 100644
--- a/flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendTools.java
+++ b/flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendTools.java
@@ -44,6 +44,9 @@
import com.vaadin.flow.server.frontend.installer.ProxyConfig;
import com.vaadin.flow.server.startup.ApplicationConfiguration;
+import static com.vaadin.flow.server.InitParameters.NODE_DOWNLOAD_ROOT;
+import static com.vaadin.flow.server.InitParameters.NODE_VERSION;
+
/**
* Provides access to frontend tools (node.js and npm, pnpm) and optionally
* installs the tools if needed.
@@ -428,6 +431,10 @@ private static FrontendToolsSettings createSettings(
.getBooleanProperty(InitParameters.NODE_AUTO_UPDATE, false);
boolean useGlobalPnpm = applicationConfiguration.getBooleanProperty(
InitParameters.SERVLET_PARAMETER_GLOBAL_PNPM, false);
+ final String nodeVersion = applicationConfiguration.getStringProperty(NODE_VERSION,
+ FrontendTools.DEFAULT_NODE_VERSION);
+ final String nodeDownloadRoot = applicationConfiguration.getStringProperty(
+ NODE_DOWNLOAD_ROOT, NodeInstaller.DEFAULT_NODEJS_DOWNLOAD_ROOT);
FrontendToolsSettings settings = new FrontendToolsSettings(
projectRoot.getAbsolutePath(),
@@ -435,6 +442,8 @@ private static FrontendToolsSettings createSettings(
settings.setForceAlternativeNode(useHomeNodeExec);
settings.setAutoUpdate(nodeAutoUpdate);
settings.setUseGlobalPnpm(useGlobalPnpm);
+ settings.setNodeVersion(nodeVersion);
+ settings.setNodeDownloadRoot(URI.create(nodeDownloadRoot));
return settings;
}
diff --git a/flow-server/src/main/java/com/vaadin/flow/server/startup/AbstractConfigurationFactory.java b/flow-server/src/main/java/com/vaadin/flow/server/startup/AbstractConfigurationFactory.java
index 3a908902601..a61a7313c4b 100644
--- a/flow-server/src/main/java/com/vaadin/flow/server/startup/AbstractConfigurationFactory.java
+++ b/flow-server/src/main/java/com/vaadin/flow/server/startup/AbstractConfigurationFactory.java
@@ -44,6 +44,8 @@
import static com.vaadin.flow.server.Constants.PROJECT_FRONTEND_GENERATED_DIR_TOKEN;
import static com.vaadin.flow.server.Constants.VAADIN_PREFIX;
import static com.vaadin.flow.server.InitParameters.BUILD_FOLDER;
+import static com.vaadin.flow.server.InitParameters.NODE_DOWNLOAD_ROOT;
+import static com.vaadin.flow.server.InitParameters.NODE_VERSION;
import static com.vaadin.flow.server.InitParameters.SERVLET_PARAMETER_ENABLE_DEV_SERVER;
import static com.vaadin.flow.server.InitParameters.SERVLET_PARAMETER_INITIAL_UIDL;
import static com.vaadin.flow.server.InitParameters.SERVLET_PARAMETER_PRODUCTION_MODE;
@@ -115,6 +117,15 @@ protected Map