All Downloads are FREE. Search and download functionalities are using the official Maven repository.

archetype-resources.pom.xml Maven / Gradle / Ivy

Go to download

A Maven Archetype for a Portofino application (backend + fronted) packaged as a WAR file, for deployment on a servlet container.

There is a newer version: 5.3.4
Show newest version
#set($dollar = '$')<?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>
    <artifactId>${artifactId}</artifactId>
    <groupId>${groupId}</groupId>
    <packaging>war</packaging>
    <version>${version}</version>
    <properties>
        <nodejs.version>v16.13.0</nodejs.version>
        <npm.version>7.5.6</npm.version>
        <portofino.version>${portofinoVersion}</portofino.version>
        <spring.boot.version>2.4.5</spring.boot.version>
        <portofino.application.directory>${dollar}{serverInfo:realPath}/WEB-INF</portofino.application.directory>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencyManagement>
        <dependencies>
            <!-- Portofino parent POM that defines the versions of all dependencies (notice scope: import) -->
            <dependency>
                <groupId>com.manydesigns</groupId>
                <artifactId>portofino</artifactId>
                <version>${portofino.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <!--
        ///////////////////////////////////////////////////////////////////////
        // This file by default includes all available modules. You can      //
        // disable those that you won't use in your application. Core        //
        // modules that you shouldn't touch unless you know very well what   //
        // you're doing are at the bottom of this file.                      //
        ///////////////////////////////////////////////////////////////////////
        -->

        <!--
        ///////////////////////////////////////////////////////////////////////
        // Database implementations. Choose the ones that apply.             //
        ///////////////////////////////////////////////////////////////////////
        -->
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-derby</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-db2</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-googlecloudsql</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-mssql</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-mysql</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-oracle</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-postgresql</artifactId>
            <version>${portofino.version}</version>
        </dependency>

        <!--
        ///////////////////////////////////////////////////////////////////////
        // Page types. Remove a module to disable its features.              //
        ///////////////////////////////////////////////////////////////////////
        -->

        <!-- CRUD and many-to-many pages. -->
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-crud</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <!--
        ///////////////////////////////////////////////////////////////////////
        // Optional services. Remove a module to disable its features.       //
        ///////////////////////////////////////////////////////////////////////
        -->

        <!-- Email -->
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-mail</artifactId>
            <version>${portofino.version}</version>
            <scope>compile</scope>
        </dependency>
        <!-- javax.mail. Some application servers natively provide it. -->
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <scope>compile</scope>
        </dependency>
        <!-- Quartz integration. -->
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-quartz</artifactId>
            <version>${portofino.version}</version>
        </dependency>

        <!--
        ///////////////////////////////////////////////////////////////////////
        // Base Portofino services. Some of them can be disabled.            //
        ///////////////////////////////////////////////////////////////////////
        -->

        <!-- Security using Apache Shiro -->
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-security-shiro</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <!-- Angular UI support -->
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-angular-ui-support</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <!-- Support for page actions. -->
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-core</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <!-- Support for database connectivity. -->
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-database</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <!-- Administration (CMS, database, wizard). Remove to disable this feature. -->
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-upstairs</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <!-- REST support through Jersey. -->
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-jersey</artifactId>
            <version>${portofino.version}</version>
        </dependency>
        <!-- REST support through RestEasy. -->
        <!--
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-resteasy</artifactId>
            <version>${portofino.version}</version>
            <scope>compile</scope>
        </dependency>
        -->
        <!-- If using RestEasy on a non-JBoss servlet container (e.g. on Tomcat) you need to uncomment this. -->
        <!--
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-servlet-initializer</artifactId>
        </dependency>
        -->
        <!-- Servlet API -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- URL rewriting for the Angular router -->
        <dependency>
            <groupId>org.tuckey</groupId>
            <artifactId>urlrewritefilter</artifactId>
            <version>4.0.3</version>
        </dependency>
        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>
        <!-- This is for building an executable war. -->
        <dependency>
            <groupId>com.manydesigns</groupId>
            <artifactId>portofino-microservice-launcher</artifactId>
            <version>${portofino.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-core</artifactId>
            <version>9.0.36</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                    <webResources>
                        <resource><directory>target/frontend/</directory></resource>
                        <resource><directory>src/main/webapp/</directory></resource>
                    </webResources>
                </configuration>
            </plugin>
            <!-- We use this to repackage the war and make it executable, even if we don't use Spring Boot.
                 If you don't plan to launch the war file with java -jar and an embedded container, you can
                 safely remove this plugin. -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring.boot.version}</version>
                <configuration>
                    <mainClass>com.manydesigns.portofino.microservices.launcher.WarFileLauncher</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <configuration>
                            <target>
                                <mkdir dir="target/frontend"/>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
        </resources>
    </build>

    <profiles>
        <profile>
            <id>build-frontend</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <version>1.9.1</version>
                        <configuration>
                            <workingDirectory>src/main/frontend</workingDirectory>
                        </configuration>
                        <executions>
                            <execution>
                                <id>install node and npm</id>
                                <goals>
                                    <goal>install-node-and-npm</goal>
                                </goals>
                                <configuration>
                                    <nodeVersion>${nodejs.version}</nodeVersion>
                                    <npmVersion>${npm.version}</npmVersion>
                                </configuration>
                            </execution>

                            <execution>
                                <id>npm install</id>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <configuration>
                                    <arguments>install --legacy-peer-deps</arguments>
                                </configuration>
                            </execution>

                            <execution>
                                <id>build-client</id>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <configuration>
                                    <arguments>run-script build</arguments>
                                </configuration>
                                <phase>generate-resources</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Build Docker images and launch the application. See web.xml for additional explanations. -->
            <id>docker</id>
            <properties>
                <portofino.application.directory>${dollar}{env:PORTOFINO_APPLICATION_DIRECTORY}</portofino.application.directory>
                <debug.port>8000</debug.port>
                <tomcat.port>8080</tomcat.port>
                <frontend.port>3000</frontend.port>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <version>0.33.0</version>
                        <configuration>
                            <images>
                                <image>
                                    <alias>${project.artifactId}</alias>
                                    <name>${project.artifactId}:${project.version}</name>
                                    <build>
                                        <contextDir>${project.basedir}/src/main/docker/application</contextDir>
                                        <assembly>
                                            <descriptor>${project.basedir}/src/main/docker/application/assembly.xml</descriptor>
                                        </assembly>
                                    </build>
                                    <run>
                                        <skip>true</skip>
                                    </run>
                                </image>
                                <image>
                                    <alias>${project.artifactId}-debug</alias>
                                    <name>${project.artifactId}-debug:${project.version}</name>
                                    <build>
                                        <contextDir>${project.basedir}/src/main/docker/application/debug</contextDir>
                                    </build>
                                    <run>
                                        <ports>
                                            <port>tomcat.port:8080</port>
                                            <port>debug.port:8000</port>
                                        </ports>
                                        <links>
                                            <!-- Choose one or more of these. You're free to remove unused images. -->
                                            <link>${project.artifactId}-database-postgresql:postgresql</link>
                                            <link>${project.artifactId}-database-mysql:mysql</link>
                                        </links>
                                        <volumes>
                                            <bind>
                                                <volume>${project.basedir}/src/main/webapp/WEB-INF:/application</volume>
                                                <volume>${project.basedir}/src/main/frontend/src/assets:/usr/local/tomcat/webapps/ROOT/assets</volume>
                                                <volume>${project.basedir}/src/main/frontend/src/pages:/usr/local/tomcat/webapps/ROOT/pages</volume>
                                            </bind>
                                        </volumes>
                                    </run>
                                </image>
                                <image>
                                    <alias>${project.artifactId}-database-postgresql</alias>
                                    <name>${project.artifactId}-database-postgresql:${project.version}</name>
                                    <build>
                                        <contextDir>${project.basedir}/src/main/docker/database/postgresql</contextDir>
                                    </build>
                                    <run>
                                        <ports>
                                            <!-- Here you can expose the database to outside tools (e.g., pgAdmin) -->
                                            <!-- <port>15432:5432</port> -->
                                        </ports>
                                        <wait>
                                            <log>database system is ready to accept connections</log>
                                            <time>20000</time>
                                        </wait>
                                    </run>
                                </image>
                                <image>
                                    <alias>${project.artifactId}-database-mysql</alias>
                                    <name>${project.artifactId}-database-mysql:${project.version}</name>
                                    <build>
                                        <contextDir>${project.basedir}/src/main/docker/database/mysql</contextDir>
                                    </build>
                                    <run>
                                        <env>
                                            <MYSQL_ROOT_PASSWORD>root</MYSQL_ROOT_PASSWORD>
                                        </env>
                                        <ports>
                                            <!-- Here you can expose the database to outside tools (e.g., MySQL workbench) -->
                                            <!-- <port>13306:3306</port> -->
                                        </ports>
                                        <wait>
                                            <log>mysqld: ready for connections</log>
                                            <time>20000</time>
                                        </wait>
                                    </run>
                                </image>
                                <image>
                                    <alias>${project.artifactId}-frontend</alias>
                                    <name>${project.artifactId}-frontend:${project.version}</name>
                                    <build>
                                        <contextDir>${project.basedir}/src/main/docker/frontend</contextDir>
                                        <assembly>
                                            <descriptor>${project.basedir}/src/main/docker/frontend/assembly.xml</descriptor>
                                        </assembly>
                                    </build>
                                    <run>
                                        <skip>true</skip>
                                        <ports>
                                            <port>frontend.port:80</port>
                                        </ports>
                                    </run>
                                </image>
                                <image>
                                    <alias>${project.artifactId}-backend</alias>
                                    <name>${project.artifactId}-backend:${project.version}</name>
                                    <build>
                                        <contextDir>${project.basedir}/src/main/docker/application/backend-only</contextDir>
                                    </build>
                                    <run>
                                        <skip>true</skip>
                                        <ports>
                                            <port>tomcat.port:8080</port>
                                        </ports>
                                    </run>
                                </image>
                            </images>
                        </configuration>
                        <executions>
                            <execution>
                                <id>docker:build</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy