Skip to content

Commit a691010

Browse files
committed
scripts for mvn production build and new scripts
1 parent cd2cf8d commit a691010

File tree

5 files changed

+80
-20
lines changed

5 files changed

+80
-20
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ Run `03_test_fe.sh` to execute the unit tests via [Karma](https://karma-runner.g
8585

8686
## Build
8787

88-
Run `04_build_fe.sh` to build the project. The build artifacts will be stored in the `dist/` directory.
88+
Run `20_build.sh` to build the project. The build artifacts will be stored in the `target/` directory.
8989

9090
```sh
91-
04_build_fe.sh
91+
20_build.sh
9292
```
9393

9494
## Code scaffolding

pom.xml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@
6969
<plugin>
7070
<groupId>org.springframework.boot</groupId>
7171
<artifactId>spring-boot-maven-plugin</artifactId>
72+
<executions>
73+
<execution>
74+
<goals>
75+
<goal>repackage</goal>
76+
</goals>
77+
</execution>
78+
</executions>
7279
</plugin>
7380
<plugin>
7481
<groupId>org.apache.maven.plugins</groupId>
@@ -96,6 +103,69 @@
96103
</annotationProcessorPaths>
97104
</configuration>
98105
</plugin>
106+
<plugin>
107+
<groupId>com.github.eirslett</groupId>
108+
<artifactId>frontend-maven-plugin</artifactId>
109+
<version>1.15.1</version> <!-- https://mvnrepository.com/artifact/com.github.eirslett/frontend-maven-plugin -->
110+
<configuration>
111+
<workingDirectory>src/main/js</workingDirectory>
112+
<installDirectory>target/temp</installDirectory>
113+
</configuration>
114+
<executions>
115+
<execution>
116+
<id>install node and npm</id>
117+
<goals>
118+
<goal>install-node-and-npm</goal>
119+
</goals>
120+
<phase>generate-resources</phase>
121+
<configuration>
122+
<nodeVersion>v20.18.0</nodeVersion>
123+
<npmVersion>10.8.2</npmVersion>
124+
</configuration>
125+
</execution>
126+
<execution>
127+
<id>npm install</id>
128+
<goals>
129+
<goal>npm</goal>
130+
</goals>
131+
<configuration>
132+
<arguments>install</arguments>
133+
</configuration>
134+
</execution>
135+
<execution>
136+
<id>prod</id>
137+
<goals>
138+
<goal>npm</goal>
139+
</goals>
140+
<configuration>
141+
<arguments>run-script build</arguments>
142+
</configuration>
143+
<phase>generate-resources</phase>
144+
</execution>
145+
</executions>
146+
</plugin>
147+
<plugin>
148+
<groupId>org.apache.maven.plugins</groupId>
149+
<artifactId>maven-resources-plugin</artifactId>
150+
<version>3.3.1</version> <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin -->
151+
<executions>
152+
<execution>
153+
<id>copy-resources</id>
154+
<phase>process-resources</phase>
155+
<goals>
156+
<goal>copy-resources</goal>
157+
</goals>
158+
<configuration>
159+
<outputDirectory>${basedir}/src/main/resources/public</outputDirectory>
160+
<resources>
161+
<resource>
162+
<directory>src/main/js/dist/angular-boilerplate/browser</directory>
163+
</resource>
164+
</resources>
165+
</configuration>
166+
</execution>
167+
</executions>
168+
</plugin>
99169
</plugins>
100170
</build>
101171

src/main/scripts/04_build_fe.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/main/scripts/12_start_server.sh renamed to src/main/scripts/20_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ echo
44
echo "maven version: $(mvn -v)"
55
echo
66

7-
mvn spring-boot:run
7+
mvn clean package spring-boot:repackage

src/main/scripts/30_start_server.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cd ../../.. || exit
2+
3+
echo
4+
java -version
5+
echo
6+
7+
java -jar target/angular-boilerplate-*.jar

0 commit comments

Comments
 (0)