<?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <properties> <mariadb-version>1.1.7</mariadb-version> <mysql-version>5.1.25</mysql-version> <package.target>notexists</package.target> <deploy.include>src/main/deploy</deploy.include> <dev.jspath>js/dev</dev.jspath> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format> </properties> <profiles> <profile> <id>nas</id> <properties> <package.target>nas</package.target> </properties> <dependencies> <dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> <version>${mariadb-version}</version> <exclusions> <exclusion> <groupId>net.java.dev.jna</groupId> <artifactId>jna</artifactId> </exclusion> </exclusions> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> <configuration> <packagingExcludes>WEB-INF/lib/mysql-connector-java*.jar</packagingExcludes> </configuration> </plugin> </plugins> </build> </profile> <profile> <id>testCust</id> <properties> <package.target>testCust</package.target> </properties> </profile> </profiles> <build> <finalName>webProject</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> <configuration> <warName>${project.build.finalName}-${project.version}-${package.target}-${maven.build.timestamp}</warName> <warSourceExcludes>${dev.jspath}/**</warSourceExcludes> <webResources> <resource> <targetPath>WEB-INF</targetPath> <directory>${deploy.include}/${package.target}</directory> <includes> <include>*.xml</include> </includes> </resource> </webResources> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.7</version> <executions> <execution> <id>copy-resources_properties</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${project.build.outputDirectory}</outputDirectory> <resources> <resource> <directory>${deploy.include}/${package.target}</directory> <includes> <include>**/*.properties</include> </includes> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>
maven命令后面添加-P+id 就可以进行触发不同的配置信息
时间: 2024-10-29 01:22:47