2018-08-20 java 通过maven配置不同的资源文件打包 通过maven配置不同的资源文件打包 POM文件12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>...</groupId> <artifactId>edas</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>CDRCB DataMarket Schedule Maven WebApp</name> <url>http://maven.apache.org</url> <properties> <spring.version>4.2.3.RELEASE</spring.version> </properties> <dependencies> ... </dependencies> <build> <finalName>edas</finalName> <plugins> <!--mybatis 逆向工程插件--> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.2</version> <configuration> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> <resources> <resource> <!--把相对应的独特资源(dev,sit,uat)声明--> <directory>src/main/resources.${deploy.type}</directory> <excludes> <exclude>*.jsp</exclude> </excludes> </resource> <resource> <!--声明公共资源--> <directory>src/main/resources</directory> </resource> </resources> </build> <!--分别设置开发,银行环境--> <profiles> <profile> <id>dev</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <deploy.type>dev</deploy.type> </properties> </profile> <profile> <id>uat</id> <properties> <deploy.type>uat</deploy.type> </properties> </profile> <profile> <id>sit</id> <properties> <deploy.type>sit</deploy.type> </properties> </profile> </profiles></project> 目录结构12345678910目录结构:-- src -- main -- java -- resource -- resource.dev -- resource.sit -- resource.uat 利用idea打包maven projects 中选择对应的环境,clean –> package Newer [转]ssh免密登陆 Older spring中init-method和destroy-method配置