-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathpom.xml
348 lines (334 loc) · 9.75 KB
/
pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mastercard.test.flow</groupId>
<artifactId>report</artifactId>
<version>1.1.7-SNAPSHOT</version>
</parent>
<artifactId>report-ng</artifactId>
<packaging>jar</packaging>
<description>Report webapp</description>
<properties>
<src.res.dir>${basedir}/dist/report</src.res.dir>
<src.index.file>${src.res.dir}/index.html</src.index.file>
<dst.res.dir>${basedir}/target/classes/com/mastercard/test/flow/report</dst.res.dir>
</properties>
<dependencies>
<dependency>
<!-- there are no tests, but this keeps builds happy
when you run the reactor with, e.g. -DexcludedGroups=gui -->
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- Step 2: Fail the build with a useful message if the compiled content isn't there -->
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>enforce-content</id>
<goals>
<goal>enforce</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<rules>
<requireFilesExist>
<message>Compiled application artifacts are missing!
Build with
* '-Dnode=system' if you already have node installed
* '-Dnode=local' if you don't have node installed, but you'd like a local installation to be created
* '-Dnode=none' if you don't want to build the webapp at all (test coverage will be reduced)</message>
<files>
<file>${src.index.file}</file>
</files>
</requireFilesExist>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- Step 3: copy the compiled content into the resources dir -->
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-content-to-artifact</id>
<goals>
<goal>copy-resources</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<outputDirectory>${dst.res.dir}</outputDirectory>
<resources>
<resource>
<directory>${src.res.dir}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- Step 4: generate a manifest file that lists the content files -->
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>create-manifest</id>
<goals>
<goal>run</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<target>
<!-- By default angular puts `type="module"` attributes on the script elements.
These break viewing a report on the filesystem. We really like that use-case,
so we're going to remove those attributes here -->
<replace file="${dst.res.dir}/index.html" value="">
<replacetoken><![CDATA[type="module"]]></replacetoken>
</replace>
<fileset dir="${dst.res.dir}" excludes="manifest.txt" id="fileset" />
<pathconvert pathsep="${line.separator}" property="filelist" refid="fileset" targetos="unix">
<map from="${dst.res.dir}/" to="" />
</pathconvert>
<echo file="${dst.res.dir}/manifest.txt">${filelist}</echo>
<fixcrlf eol="unix" file="${dst.res.dir}/manifest.txt" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<!-- The following profiles generate the compiled webapp artifacts -->
<!-- Once the compiled artifacts exist, you can trigger recompilation by explictly activating
the profile you *do* want, e.g.: -->
<!-- if you *do* have node installed: `mvn -Psystem-node clean package -->
<!-- if you *don't* have node installed: `mvn -Plocal-node clean package -->
<profile>
<id>node-local</id>
<!-- Use this profile if you *don't* have node and npm installed on your
system. Maven will create a local installation (in your home directory) of
the tools it needs -->
<activation>
<property>
<name>node</name>
<value>local</value>
</property>
<file>
<missing>${src.index.file}</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<!-- Step 1: compile the angular projects into the dist directory -->
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<configuration>
<nodeVersion>v14.15.1</nodeVersion>
<installDirectory>target</installDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>initialize</phase>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<phase>initialize</phase>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>node-local-test</id>
<activation>
<property>
<name>node</name>
<value>local</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<!-- Step 1: compile the angular projects into the dist directory -->
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<configuration>
<nodeVersion>v14.15.1</nodeVersion>
<installDirectory>target</installDirectory>
</configuration>
<executions>
<execution>
<id>npm run test</id>
<goals>
<goal>npm</goal>
</goals>
<phase>test</phase>
<configuration>
<arguments>run test</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>node-system</id>
<!-- Use this profile if you *do* have node and npm installed, and you'd
prefer to use those -->
<activation>
<property>
<name>node</name>
<value>system</value>
</property>
<file>
<missing>${src.index.file}</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<!-- Step 1: compile the angular projects into the dist directory -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>npm install</id>
<goals>
<goal>exec</goal>
</goals>
<phase>initialize</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>node-system-test</id>
<activation>
<property>
<name>node</name>
<value>system</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>npm run test</id>
<goals>
<goal>exec</goal>
</goals>
<phase>test</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>node-none</id>
<!-- Use this profile if you don't want any part of this node malarkey. We'll copy a dummy index.html into
place to satisfy the enforce-content check, but it's not going to provide a useful visualisation
of the flow data -->
<!-- The node=none property will disable the tests that assume the webapp is functional -->
<activation>
<property>
<name>node</name>
<value>none</value>
</property>
<file>
<missing>${src.index.file}</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<!-- Step 1: copy a dummy index.html into the dist directory -->
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-dummy-index</id>
<goals>
<goal>copy-resources</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<outputDirectory>${src.res.dir}</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/no-node</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>