• Maven实战读书笔记(七):Maven常用功能


    7.1、资源排除

    <resources>
       <!-- 启动过滤,包含的文件会被过滤掉 -->
       <resource>
         <directory>src/main/resources</directory>
         <filtering>true</filtering>
         <includes>
           <include>src/main/resources/dev/*.*</include>
           <include>src/main/resources/local/*.*</include>
         </includes>
       </resource>
     
      <!-- 不启动过滤,包含的文件会被打包 -->
      <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
        <includes>
          <include>*.xml</include>
          <include>*.properties</include>
        </includes>
      </resource>
     </resources>
    

    7.2、环境区分

     <!-- 配置 -->
     <profiles>
        <!-- 开发环境 -->
        <profile>
         <id>dev</id>
         <activation>
           <activeByDefault>true</activeByDefault>
         </activation>
         <build>
         <plugins>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-antrun-plugin</artifactId>
             <version>1.1</version>
             <executions>
               <execution>
                 <phase>test</phase>
                 <goals>
                   <goal>run</goal>
                 </goals>
                 <configuration>
                   <tasks>
                     <echo>Using dev</echo>
                     <copy file="src/main/resources/dev/systemParm.properties"
    tofile="${project.build.outputDirectory}/systemParm.properties" />
                   </tasks>
                 </configuration>
               </execution>
             </executions>
           </plugin>
         </plugins>
       </build>
       </profile>
    
     <!-- 本地环境 -->
     <profile>
       <id>local</id>
       <build>
         <plugins>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-antrun-plugin</artifactId>
             <version>1.1</version>
             <executions>
               <execution>
                 <phase>test</phase>
                 <goals>
                   <goal>run</goal>
                 </goals>
                 <configuration>
                 <tasks>
                   <echo>Using local</echo>
                   <copy file="src/main/resources/local/systemParm.properties"
    tofile="${project.build.outputDirectory}/systemParm.properties" />
                 </tasks>
               </configuration>
             </execution>
           </executions>
         </plugin>
         </plugins>
         </build>
         </profile>
     </profiles>
    

    7.3.配置jdk版本—maven全局配置

    <profile>    
       <id>JDK-1.8</id>
       <activation>
         <activeByDefault>true</activeByDefault>
         <jdk>1.8</jdk>
       </activation>
       <properties>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
         <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
       </properties>
     </profile>
    
  • 相关阅读:
    JavaScript+IndexedDB实现留言板:客户端存储数据
    怎么限制Google自动调整字体大小
    《互联网时代》告诉我的互联网简史(二)
    《互联网时代》告诉我的互联网简史(一)
    CSS换行:word-wrap、word-break和text-wrap区别
    php中的字符串和正则表达式
    php数组使用小结
    问题:关于一个贴友的js留言板的实现
    问题:关于坛友的一个定时重复显示和隐藏div的实现
    使用union 外加count
  • 原文地址:https://www.cnblogs.com/Jxwz/p/8372383.html
Copyright © 2020-2023  润新知