KISS your WARs--Skipping the Superfluous
Both apache maven and Java EE heavily rely on (Convention over Configuration).
Productive, straight-forward "Don't make me think" ThinWARs, fast builds and deployments, short
pom.xml are a result of applying the built-in, sensible defaults.
- project folder
namein pom.xml (
nameis derived from
artifactId, so remove it)
- WAR name
- and so the JAX-RS URI
- there are no nice-to-have
- there are no maven plugins declared
- there is no pom inheritance
- the only
provideddependencies are the Java EE / Jakarta EE and MicroProfile API
<project> <modelVersion>4.0.0</modelVersion> <groupId>com.airhacks</groupId> <artifactId>thinwar</artifactId> <version>0.0.1</version> <packaging>war</packaging> <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>8.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.eclipse.microprofile</groupId> <artifactId>microprofile</artifactId> <version>1.3</version> <type>pom</type> <scope>provided</scope> </dependency> </dependencies> <build> <finalName>thinwar</finalName> </build> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <failOnMissingWebXml>false</failOnMissingWebXml> </properties> </project>
The resulting ThinWAR is KISS and YAGNI, without any Cargo Cult Programming involved.
A conventional ThinWAR project can be directly created with javaee8-essentials-archetype and deployed with wad.sh.
See you at Web, MicroProfile and Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.
what about database drivers? modding app server?
Posted by kret11 on February 11, 2019 at 04:05 PM CET #
1. JDBC-drivers never ship with the WAR, they are installed on the server.
2. Appserver configuration either happens on Jenkins, Docker or s2i.
3. However, domain-specific libraries like e.g. Apache POI can be included in the WAR (runtime dependency)
big thanks for your question!
Posted by Adam Bien on February 12, 2019 at 01:42 AM CET #