• Maven多环境打包


     1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     2     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     3     <modelVersion>4.0.0</modelVersion>
     4     <groupId>com.ai</groupId>
     5     <artifactId>rgshcore</artifactId>
     6     <packaging>war</packaging>
     7     <version>1.0</version>
     8     <name>rgshcore</name>
     9     <properties>
    10         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    11         <org.apache.spring.version>3.2.13.RELEASE</org.apache.spring.version>
    12         <zookeeper.version>3.4.5</zookeeper.version>
    13         <package.environment>quartz</package.environment>
    14     </properties>
    15 
    16 
    17     <profiles>
    18         <profile>
    19             <id>queue</id>
    20             <properties>
    21                 <!-- 此处package.environment 应该是自定义参数 -->
    22                 <package.environment>queue</package.environment>
    23             </properties>
    24         </profile>
    25         <profile>
    26             <id>app</id>
    27             <properties>
    28                 <package.environment>app</package.environment>
    29             </properties>
    30             <!-- 默认生成环境 -->
    31             <!--<activation> <activeByDefault>true</activeByDefault> </activation> -->
    32         </profile>
    33         <profile>
    34             <id>test</id>
    35             <properties>
    36                 <!-- 此处release.file 应该是自定义参数 -->
    37                 <release.file>test</release.file>
    38             </properties>
    39         </profile>
    40         <profile>
    41             <id>product</id>
    42             <properties>
    43                 <release.file>product</release.file>
    44             </properties>
    45         </profile>
    46     </profiles>
    47 
    48     <build>
    49         <plugins>
    50             <!-- 打包 -->
    51             <plugin>
    52                 <artifactId>maven-antrun-plugin</artifactId>
    53                 <executions>
    54                     <execution>
    55                         <phase>compile</phase>
    56                         <goals>
    57                             <goal>run</goal>
    58                         </goals>
    59                         <configuration>
    60                             <tasks>
    61                                 <!-- 可以显示打包的环境 -->
    62                                 <echo>@@@@@@@@@@@@@@@@@@${package.environment}@@@@@@@@@@@@@@@@@@@@@</echo>
    63                                 <echo>@@@@@@@@@@@@@@@@@@${release.file}@@@@@@@@@@@@@@@@@@@@@</echo>
    64                             </tasks>
    65                         </configuration>
    66                     </execution>
    67                 </executions>
    68             </plugin>
    69             <!-- 打包 -->
    70             <plugin>
    71                 <groupId>org.apache.maven.plugins</groupId>
    72                 <artifactId>maven-war-plugin</artifactId>
    73                 <configuration>
    74                     <archive>
    75                         <addMavenDescriptor>false</addMavenDescriptor>
    76                     </archive>
    77                     <warName>rgshcore</warName>
    78                     <!-- 过滤不打的文件 -->
    79                     <packagingExcludes>WEB-INF/classes/spring/app/**,WEB-INF/classes/spring/queue/**,WEB-INF/classes/config/product/**,WEB-INF/classes/config/test/**</packagingExcludes>
    80                     <webResources>
    81                         <resource>
    82                             <directory>src/main/resources/spring/${package.environment}/</directory>
    83                             <targetPath>WEB-INF/classes/spring</targetPath>
    84                             <filtering>true</filtering>
    85                         </resource>
    86                         <resource>
    87                             <directory>src/main/resources/config/${release.file}/</directory>
    88                             <targetPath>WEB-INF/classes/config</targetPath>
    89                             <filtering>true</filtering>
    90                         </resource>
    91                     </webResources>
    92                 </configuration>
    93             </plugin>
    94         </plugins>
    95     </build>
    96 </project>
  • 相关阅读:
    【Python爬虫】第五课(b站弹幕)
    【Python爬虫】第四课(查询照片拍摄地址)
    一些tips
    【Python爬虫】第三课(提取数据)
    【Python爬虫】第二课(请求头设置)
    【Python爬虫】第一课
    【数据分析】如何进行数据分析
    【数据分析】派单排序策略优化验证(附sql查询代码)
    python基础01
    消息
  • 原文地址:https://www.cnblogs.com/Yiran583/p/4871839.html
Copyright © 2020-2023  润新知