Project servlet-pom.xml

This is project servlet-pom.xml file. It is used as parent for all servlet microservices.

Content

<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>example-project</artifactId>
        <groupId>com.example</groupId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>./pom.xml</relativePath>
    </parent>

    <artifactId>servlet-example-project</artifactId>
    <packaging>pom</packaging>

    <properties>
        <main.dir>${project.basedir}/</main.dir>
        <jlupin.deploy.skip>false</jlupin.deploy.skip>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring.boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.jlupin</groupId>
            <artifactId>jlupin-platform-servlet</artifactId>
        </dependency>

        <dependency>
            <groupId>com.jlupin</groupId>
            <artifactId>jlupin-spring-boot-2-servlet-monitor</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </dependency>

        <dependency>
            <groupId>com.example</groupId>
            <artifactId>common-util</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>com.example</groupId>
            <artifactId>common-pojo</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>${maven.war.plugin.version}</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring.boot.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.jlupin</groupId>
                <artifactId>jlupin-platform-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>jlupin-zip</id>
                        <goals>
                            <goal>zip</goal>
                        </goals>
                        <configuration>
                            <additionalFilesDirectories>
                                <param>../additional-files</param>
                            </additionalFilesDirectories>
                        </configuration>
                    </execution>
                    <execution>
                        <id>jlupin-deploy</id>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

Description

What can be found in this file?

  • Parent of this project is set to project pom.xml file for global configuration to be inherited.
  • Useful property main.dir is set for accessing your main project directory.
  • Property jlupin.deploy.skip is overwritten to true so modules with this pom set as parent will be taken for deploying to platform.
  • Inlucded Spring Boot dependencies definition with version specified in project pom.xml.
  • Added dependency to jlupin-platform-servlet which contains all required dependencies for servlet microservice.
  • Added dependency to common-pojo for access to it's classes.
  • Added dependency to common-util for access to it's classes.
  • Added dependency to jupin-platform-spring-boot-2-servlet-monitor for monitoring Spring Boot application.
  • Spring boot starters added and configured for using log4j2 as logger and tomcat as server.
  • Added cofniguration for building war spring boot application.
  • Added execution fo goal repackage for creating Spring Boot fat jar.
  • Added execution of goal zip for creating JLupin Platform deplyable unit configured to include additional-files directory, where for example microservice configuration is placed.
  • Added execution of goal deploy for deploying microservice. By default it is not executed with any phase.