Maven 打包时排除不想打包的文件&跳过测试

打包时不将资源文件夹下的文件打入包中 

pom.xml

<build>    
  <plugins>
   <plugin>    
    <groupId>org.apache.maven.plugins</groupId>    
    <artifactId>maven-war-plugin</artifactId>    
    <version>2.0.2</version>    
    <configuration>    
     <warSourceExcludes>src/main/resources/**</warSourceExcludes>    
    </configuration>    
   </plugin>    
  </plugins>    
 </build>

 

跳过测试

1. pom.xml

<plugin>  
    <groupId>org.apache.maven.plugins</groupId>  
    <artifactId>maven-surefire-plugin</artifactId>  
    <configuration>  
        <skip>true</skip>  
    </configuration>  
</plugin>

2. 命令

mvn test -Dmaven.test.failure.ignore=true 
mvn install -Dmaven.test.skip=true 

     

 

按不同的配置参数打包:

mvn clean package -PtestServer

mvn clean package -Pdevelop

pom.xml

  <profiles>
   <profile>
    <id>develop</id>
    <activation>
   <activeByDefault>true</activeByDefault>
  </activation>
  <properties>
  <!-- local --> 
   <com.xxx.xxx.log.dir>D:\apache-tomcat-6.0.18\logs\</com.xxx.xxx.log.dir>
   <com.xxx.xxx.upload.temp.dir>C:/temp</com.xxx.xxx.upload.temp.dir>
   <com.xxx.xxx.node.image.root.url>http://127.0.0.1:8080/xxx_war/images/node/banner/</com.xxx.xxx.node.image.root.url>
   <com.xxx.xxx.upload.node.image.savePath>D:/xxx/upload/images/node/banner/</com.xxx.xxx.upload.node.image.savePath>
  </properties>
   </profile>
   <profile>
    <id>testServer</id>
    <activation>
   <activeByDefault>false</activeByDefault>
  </activation>
  <properties>  
  <!-- test server -->
   <com.xxx.xxx.log.dir>/home/xxx/logs/</com.xxx.xxx.log.dir>
   <com.xxx.xxx.upload.temp.dir>/home/xxx/upload/temp</com.unionread.publish.upload.temp.dir>
   <com.xxx.xxx.node.image.root.url>http://192.168.1.1:8091/xxx_war/images/node/banner/</com.xxx.xxx.node.image.root.url>
   <com.xxx.xxx.upload.node.image.savePath>/home/xxx/upload/images/node/banner/</com.xxx.xxx.upload.node.image.savePath>
  </properties>
   </profile>
  </profiles>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值