adam bien's blog

Essential JavaEE 7 pom.xml …With 21 LoC 📎

Maven properties make the explicit declaration of compile and war plugins obsolete and shrink a JavaEE 7 pom.xml to 21 lines of XML:


<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.airhacks</groupId>
    <artifactId>javaee7-essentials-pom</artifactId>
    <version>7.0</version>
    <packaging>war</packaging>
    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <properties>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </properties>
</project>

Start with the minimum, everything else is over engineering, sometimes even "Cargo Cult Programming":

"Cargo cult programming is a style of computer programming that is characterized by the ritual inclusion of code or program structures that serve no real purpose."

From: http://en.wikipedia.org/wiki/Cargo_cult_programming :-)

See also: https://github.com/AdamBien/javaee-essentials-pom

Thanks Arend v. Reinersdorff for the idea!

See you at Java EE Workshops at MUC Airport, particularly at http://workshops.adam-bien.com/effective-javaee.htm!