码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-01-28 21:59:58      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:echo   maven   配置jdk   project   --   code   main   文件   mpi   

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>

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

标签:echo   maven   配置jdk   project   --   code   main   文件   mpi   

原文地址:https://www.cnblogs.com/Jxwz/p/8372383.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!