Advertisement
npuleio

pom xml production mode

May 15th, 2024
629
0
16 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 6.40 KB | Source Code | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3.    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4.    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5.     <modelVersion>4.0.0</modelVersion>
  6.     <!-- Project from https://start.vaadin.com/project/9341ce37-5519-4679-9e05-365c2e9c9caf -->
  7.     <groupId>com.myexample.application</groupId>
  8.     <artifactId>myexample</artifactId>
  9.     <name>myexample</name>
  10.     <version>1.0.0</version>
  11.     <packaging>jar</packaging>
  12.  
  13.     <properties>
  14.         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  15.         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  16.         <java.version>17</java.version>
  17.         <vaadin.version>24.3.11</vaadin.version>
  18.         <tomcat.version>10.1.23</tomcat.version>
  19.     </properties>
  20.  
  21.     <parent>
  22.         <groupId>org.springframework.boot</groupId>
  23.         <artifactId>spring-boot-starter-parent</artifactId>
  24.         <version>3.2.5</version>
  25.         <relativePath /> <!-- lookup parent from repository -->
  26.     </parent>
  27.  
  28.     <repositories>
  29.         <repository>
  30.             <id>Vaadin Directory</id>
  31.             <url>https://maven.vaadin.com/vaadin-addons</url>
  32.             <snapshots>
  33.                 <enabled>false</enabled>
  34.             </snapshots>
  35.         </repository>
  36.     </repositories>
  37.  
  38.     <dependencyManagement>
  39.         <dependencies>
  40.             <dependency>
  41.                 <groupId>com.vaadin</groupId>
  42.                 <artifactId>vaadin-bom</artifactId>
  43.                 <version>${vaadin.version}</version>
  44.                 <type>pom</type>
  45.                 <scope>import</scope>
  46.             </dependency>
  47.         </dependencies>
  48.     </dependencyManagement>
  49.  
  50.     <dependencies>
  51.         <dependency>
  52.             <groupId>com.vaadin</groupId>
  53.             <!-- Replace artifactId with vaadin-core to use only free components -->
  54.             <artifactId>vaadin</artifactId>
  55.             <exclusions>
  56.                 <exclusion>
  57.                     <groupId>com.vaadin</groupId>
  58.                     <artifactId>vaadin-dev</artifactId>
  59.                 </exclusion>
  60.             </exclusions>
  61.         </dependency>
  62.         <dependency>
  63.             <groupId>com.vaadin</groupId>
  64.             <artifactId>vaadin-spring-boot-starter</artifactId>
  65.         </dependency>
  66.         <dependency>
  67.             <groupId>org.parttio</groupId>
  68.             <artifactId>line-awesome</artifactId>
  69.             <version>2.0.0</version>
  70.         </dependency>
  71.  
  72.         <dependency>
  73.             <groupId>org.springframework.boot</groupId>
  74.             <artifactId>spring-boot-starter-validation</artifactId>
  75.         </dependency>
  76.         <!-- <dependency>
  77.            <groupId>org.springframework.boot</groupId>
  78.            <artifactId>spring-boot-devtools</artifactId>
  79.            <optional>true</optional>
  80.        </dependency> -->
  81.         <!-- <dependency>
  82.            <groupId>org.springframework.boot</groupId>
  83.            <artifactId>spring-boot-starter-test</artifactId>
  84.            <scope>test</scope>
  85.        </dependency> -->
  86.         <dependency>
  87.             <groupId>org.springframework.boot</groupId>
  88.             <artifactId>spring-boot-starter-tomcat</artifactId>            
  89.         </dependency>        
  90.         <!-- <dependency>
  91.            <groupId>com.vaadin</groupId>
  92.            <artifactId>vaadin-testbench-junit5</artifactId>
  93.            <scope>test</scope>
  94.        </dependency> -->
  95.     </dependencies>
  96.  
  97.     <build>
  98.         <defaultGoal>spring-boot:run</defaultGoal>
  99.         <plugins>
  100.             <plugin>
  101.                 <groupId>org.springframework.boot</groupId>
  102.                 <artifactId>spring-boot-maven-plugin</artifactId>
  103.             </plugin>
  104.         </plugins>
  105.     </build>
  106.  
  107.     <profiles>
  108.         <profile>
  109.             <!-- Production mode is activated using -Pproduction -->
  110.             <id>production</id>
  111.             <properties>
  112.                 <vaadin.productionMode>true</vaadin.productionMode>
  113.             </properties>
  114.             <dependencies>
  115.                 <!-- Exclude development dependencies from production -->                
  116.                 <dependency>
  117.                     <groupId>com.vaadin</groupId>
  118.                     <artifactId>vaadin</artifactId>
  119.                     <exclusions>
  120.                         <exclusion>
  121.                             <groupId>com.vaadin</groupId>
  122.                             <artifactId>vaadin-dev-server</artifactId>
  123.                         </exclusion>
  124.                     </exclusions>
  125.                 </dependency>
  126.             </dependencies>
  127.             <build>
  128.                 <plugins>
  129.                     <plugin>
  130.                         <groupId>com.vaadin</groupId>
  131.                         <artifactId>vaadin-maven-plugin</artifactId>
  132.                         <version>${vaadin.version}</version>
  133.                         <executions>
  134.                             <execution>
  135.                                 <goals>
  136.                                     <goal>build-frontend</goal>
  137.                                 </goals>
  138.                                 <phase>compile</phase>
  139.                             </execution>
  140.                         </executions>
  141.                         <configuration>
  142.                             <!-- To always force an optimized production bundle build set this configuration to 'true' -->
  143.                             <!-- To possibly use the pre-compiled production bundle remove or set to 'false' -->
  144.                             <forceProductionBuild>true</forceProductionBuild>
  145.                             <frontendHotdeploy>false</frontendHotdeploy>                
  146.                             <!-- To have reproducible build by running 'npm ci' -->
  147.                             <ciBuild>true</ciBuild>
  148.                         </configuration>                
  149.                     </plugin>                  
  150.                     <plugin>
  151.                         <groupId>org.apache.maven.plugins</groupId>
  152.                         <artifactId>maven-jar-plugin</artifactId>
  153.                         <configuration>
  154.                           <archive>
  155.                             <manifest>
  156.                               <addClasspath>true</addClasspath>
  157.                               <classpathPrefix>target/classes/</classpathPrefix>
  158.                               <mainClass>com.myexample.application.Application</mainClass>
  159.                             </manifest>
  160.                           </archive>
  161.                         </configuration>
  162.                     </plugin>                                          
  163.                 </plugins>
  164.             </build>
  165.         </profile>
  166.  
  167.     </profiles>
  168. </project>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement