1. 程式人生 > >maven打包排除排除指定檔案(war,jar)

maven打包排除排除指定檔案(war,jar)

war包排除檔案

<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<configuration>
				<source>${java.source.version}</source>
				<target>${java.target.version}</target>
				<encoding>UTF-8</encoding>
			</configuration>
		</plugin>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-war-plugin</artifactId>
			<version>2.2</version>
			<configuration>
				<warName>${project.build.finalName}</warName>
				<excludes>
					js/plugins/*.*
				</excludes>
				<packagingExcludes>
					WEB-INF/classes/jdbc.properties,
					WEB-INF/classes/redis.properties,
					WEB-INF/classes/system.properties
				</packagingExcludes>
			</configuration>
		</plugin>
	<plugins>
</build>
可執行jar包,maven-shade-plugin外掛
<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-shade-plugin</artifactId>
			<version>2.4.1</version>
			<executions>
				<execution>
					<phase>package</phase>
					<goals>
						<goal>shade</goal>
					</goals>
					<configuration>
						<transformers>
							<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
								<mainClass>com.suma.srs.transform.main.EntryMain</mainClass>
							</transformer>
							<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
								<resource>META-INF/spring.handlers</resource>
							</transformer>
							<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
								<resource>META-INF/spring.schemas</resource>
							</transformer>
						</transformers>
					</configuration>
				</execution>
			</executions>
			<configuration>
				<filters>
					<filter>
						<artifact>*:*</artifact>
						<excludes>
							<exclude>jdbc.properties</exclude>
							<exclude>system.properties</exclude>
						</excludes>
					</filter>
				</filters>
			</configuration>
		</plugin>
	<plugins>
</build>