You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e87a047
Browse filesBrowse the repository at this point in the historyBrowse files
@@ -236,6 +236,178 @@ Copy the `logging.properties` file from the MapStore repository (`product/cargo/
236
236
237
237
**CI/CD**: update your build infrastructure to use JDK 17 as the build JDK.
238
238
239
+
### Duplicated libraries in the WAR
240
+
241
+
The GeoStore and http-proxy WARs are added to your project as *overlays*: their `WEB-INF/lib` folder is copied as it is into your WAR. Some of those libraries (Jackson, Log4j, SLF4J, Micrometer, commons-io, ...) are also brought by MapStore, often in a different version, so the final WAR contains two versions of the same library, and which one is loaded depends on the servlet container.
242
+
243
+
The steps below remove the duplicates. They change only two files of your project: `pom.xml` and `web/pom.xml`. The [project templates](https://github.com/geosolutions-it/MapStore2/tree/master/project/standard/templates) contain the final result, if you want to compare.
244
+
245
+
#### 1. `pom.xml` (in the root folder of your project)
246
+
247
+
**1.1** In the `<properties>` section, add these two lines right after the `jackson.version` line (updated to `2.22.3` in the previous section):
248
+
249
+
```diff
250
+
<jackson.version>2.22.3</jackson.version>
251
+
+ <guava.version>32.0.0-jre</guava.version>
252
+
+ <jsr305.version>3.0.2</jsr305.version>
253
+
```
254
+
255
+
**1.2** In the `<dependencyManagement>` section, find the `jackson-bom` dependency and add the two dependencies below right after it (after its closing `</dependency>` tag):
256
+
257
+
```diff
258
+
<dependency>
259
+
<groupId>com.fasterxml.jackson</groupId>
260
+
<artifactId>jackson-bom</artifactId>
261
+
<version>${jackson.version}</version>
262
+
<type>pom</type>
263
+
<scope>import</scope>
264
+
</dependency>
265
+
+ <dependency>
266
+
+ <groupId>com.google.guava</groupId>
267
+
+ <artifactId>guava</artifactId>
268
+
+ <version>${guava.version}</version>
269
+
+ </dependency>
270
+
+ <dependency>
271
+
+ <groupId>com.google.code.findbugs</groupId>
272
+
+ <artifactId>jsr305</artifactId>
273
+
+ <version>${jsr305.version}</version>
274
+
+ </dependency>
275
+
```
276
+
277
+
#### 2. `web/pom.xml`
278
+
279
+
**2.1** The servlet API is provided by Tomcat and must not be packaged in the WAR. In the main `<dependencies>` section (at the top of the file), find the `jakarta.servlet-api` dependency and add the `<scope>` line:
280
+
281
+
```diff
282
+
<dependency>
283
+
<groupId>jakarta.servlet</groupId>
284
+
<artifactId>jakarta.servlet-api</artifactId>
285
+
<version>${jakarta.servlet-api.version}</version>
286
+
+ <scope>provided</scope>
287
+
</dependency>
288
+
```
289
+
290
+
**2.2** Find the `maven-war-plugin` plugin. Inside its `<configuration>`, delete the whole `<packagingExcludes>` block: it lists versions that are not used anymore.
291
+
292
+
```diff
293
+
<configuration>
294
+
- <packagingExcludes>
295
+
- WEB-INF/lib/*spring*5.3.18*.jar,
296
+
- WEB-INF/lib/json-lib-2.4-jdk15.jar,
297
+
- WEB-INF/lib/msg-simple-1.1.jar,
298
+
- WEB-INF/lib/btf-1.2.jar,
299
+
- WEB-INF/lib/commons-io-2.1.jar,
300
+
- WEB-INF/lib/commons-beanutils-1.8.0.jar,
301
+
- WEB-INF/lib/commons-logging-1.1.1.jar,
302
+
- WEB-INF/lib/jackson-coreutils-1.6.jar,
303
+
- WEB-INF/lib/stax-ex-1.8.jar
304
+
- </packagingExcludes>
305
+
<overlays>
306
+
```
307
+
308
+
**2.3** In the same `<configuration>`, inside `<overlays>`, add an `<excludes>` block to each of the two overlays, right after their `<artifactId>` line. If an overlay already has an `<excludes>` block, keep the `<exclude>` lines it has and add the new ones to it.
**2.4** Find the `<profile>` with `<id>printing</id>` (near the end of the file). Inside it there is a `<dependencyManagement>` section with another `jakarta.servlet-api` dependency: add the same `<scope>` line as in step 2.1.
346
+
347
+
```diff
348
+
<dependency>
349
+
<groupId>jakarta.servlet</groupId>
350
+
<artifactId>jakarta.servlet-api</artifactId>
351
+
<version>${jakarta.servlet-api.version}</version>
352
+
+ <scope>provided</scope>
353
+
</dependency>
354
+
```
355
+
356
+
**2.5** In the same `printing` profile, find the `print-lib` dependency. In its `<exclusions>`:
357
+
358
+
- delete the `commons-codec` exclusion:
359
+
360
+
```diff
361
+
- <exclusion>
362
+
- <groupId>commons-codec</groupId>
363
+
- <artifactId>commons-codec</artifactId>
364
+
- </exclusion>
365
+
```
366
+
367
+
- add these five exclusions before the closing `</exclusions>` tag (JAXB is already shipped by GeoStore, HTTP Client 5 by http-proxy):
The script must print `No duplicated libraries`. Otherwise it lists the libraries found in more than one version: if they come from a dependency you added to your project, exclude the older version.
410
+
239
411
### New `viewFramingFilter` in `web.xml`
240
412
241
413
Add the following filter to your project's `web/src/main/webapp/WEB-INF/web.xml`, mapped on `/index.html` (see the updated [project template](https://github.com/geosolutions-it/MapStore2/blob/master/project/standard/templates/web/src/main/webapp/WEB-INF/web.xml) for reference). It relies on `org.apache.catalina.filters.HttpHeaderSecurityFilter`, already available with the Tomcat 10.1 dependency required by the upgrade above:
0 commit comments