Skip to content

Commit 919d18d

Browse files
cdpreteSteKoe
andauthored
chore: Add 'localNpm' Maven build profile and 'npm.registry' Maven property to accomodate the UI build in corporate environments (#5465)
Co-authored-by: Stephan Köninger <stephan.koeninger@codecentric.de>
1 parent 1f991ea commit 919d18d

2 files changed

Lines changed: 94 additions & 4 deletions

File tree

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
<maven-dependency-plugin.version>3.11.0</maven-dependency-plugin.version>
7171
<maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
7272
<maven-enforcer-plugin.version>3.6.3</maven-enforcer-plugin.version>
73+
<maven-exec-plugin.version>3.6.3</maven-exec-plugin.version>
7374
<maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version>
7475
<maven-failsafe-plugin.version>3.5.6</maven-failsafe-plugin.version>
7576
<maven-install-plugin.version>3.1.4</maven-install-plugin.version>
@@ -432,6 +433,11 @@
432433
<artifactId>spring-configuration-property-documenter-maven-plugin</artifactId>
433434
<version>${spring-conf-prop-documenter-maven-plugin.version}</version>
434435
</plugin>
436+
<plugin>
437+
<groupId>org.codehaus.mojo</groupId>
438+
<artifactId>exec-maven-plugin</artifactId>
439+
<version>${maven-exec-plugin.version}</version>
440+
</plugin>
435441
</plugins>
436442
</pluginManagement>
437443
</build>

spring-boot-admin-server-ui/pom.xml

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@
3333

3434
<properties>
3535
<ui-resources.relative-path>META-INF/spring-boot-admin-server-ui</ui-resources.relative-path>
36+
37+
<npm.install.args>ci --prefer-offline --no-progress --no-audit --silent</npm.install.args>
38+
<npm.build.args>run build</npm.build.args>
39+
<npm.lint.args>run lint</npm.lint.args>
40+
<npm.test.args>run test</npm.test.args>
41+
<!-- To be overridden with -Dnpm.registry=https://foo.bar if the standard registry is not wanted or not accessible -->
42+
<npm.registry>https://registry.npmjs.org/</npm.registry>
3643
</properties>
3744

3845
<dependencies>
@@ -122,6 +129,83 @@
122129
</plugins>
123130
</build>
124131
</profile>
132+
<!--
133+
Profile: localNpm
134+
Set this profile to run frontend related build steps using the local NPM installation.
135+
Skipping frontend tests can be achieved by using default flag -D skipTests.
136+
-->
137+
<profile>
138+
<id>localNpm</id>
139+
<build>
140+
<plugins>
141+
<plugin>
142+
<groupId>com.github.eirslett</groupId>
143+
<artifactId>frontend-maven-plugin</artifactId>
144+
<configuration>
145+
<skip>true</skip>
146+
</configuration>
147+
</plugin>
148+
149+
<plugin>
150+
<groupId>org.codehaus.mojo</groupId>
151+
<artifactId>exec-maven-plugin</artifactId>
152+
<executions>
153+
<execution>
154+
<id>npm-install</id>
155+
<phase>generate-resources</phase>
156+
<goals>
157+
<goal>exec</goal>
158+
</goals>
159+
<configuration>
160+
<executable>npm</executable>
161+
<commandlineArgs>${npm.install.args}</commandlineArgs>
162+
<environmentVariables>
163+
<NPM_CONFIG_REGISTRY>${npm.registry}</NPM_CONFIG_REGISTRY>
164+
</environmentVariables>
165+
</configuration>
166+
</execution>
167+
<execution>
168+
<id>npm-build</id>
169+
<phase>generate-resources</phase>
170+
<goals>
171+
<goal>exec</goal>
172+
</goals>
173+
<configuration>
174+
<executable>npm</executable>
175+
<commandlineArgs>${npm.build.args}</commandlineArgs>
176+
<environmentVariables>
177+
<PROJECT_VERSION>${project.version}</PROJECT_VERSION>
178+
</environmentVariables>
179+
</configuration>
180+
</execution>
181+
<execution>
182+
<id>npm-lint</id>
183+
<phase>verify</phase>
184+
<goals>
185+
<goal>exec</goal>
186+
</goals>
187+
<configuration>
188+
<executable>npm</executable>
189+
<commandlineArgs>${npm.lint.args}</commandlineArgs>
190+
</configuration>
191+
</execution>
192+
<execution>
193+
<id>npm-test</id>
194+
<phase>test</phase>
195+
<goals>
196+
<goal>exec</goal>
197+
</goals>
198+
<configuration>
199+
<skip>${skipTests}</skip>
200+
<executable>npm</executable>
201+
<commandlineArgs>${npm.test.args}</commandlineArgs>
202+
</configuration>
203+
</execution>
204+
</executions>
205+
</plugin>
206+
</plugins>
207+
</build>
208+
</profile>
125209
</profiles>
126210

127211
<build>
@@ -155,7 +239,7 @@
155239
<goal>npm</goal>
156240
</goals>
157241
<configuration>
158-
<arguments>ci --prefer-offline --no-progress --no-audit --silent</arguments>
242+
<arguments>${npm.install.args}</arguments>
159243
</configuration>
160244
</execution>
161245
<execution>
@@ -164,7 +248,7 @@
164248
<goal>npm</goal>
165249
</goals>
166250
<configuration>
167-
<arguments>run build</arguments>
251+
<arguments>${npm.build.args}</arguments>
168252
<environmentVariables>
169253
<PROJECT_VERSION>${project.version}</PROJECT_VERSION>
170254
</environmentVariables>
@@ -177,7 +261,7 @@
177261
</goals>
178262
<phase>verify</phase>
179263
<configuration>
180-
<arguments>run lint</arguments>
264+
<arguments>${npm.lint.args}</arguments>
181265
</configuration>
182266
</execution>
183267
<execution>
@@ -187,7 +271,7 @@
187271
</goals>
188272
<phase>test</phase>
189273
<configuration>
190-
<arguments>run test</arguments>
274+
<arguments>${npm.test.args}</arguments>
191275
</configuration>
192276
</execution>
193277
</executions>

0 commit comments

Comments
 (0)