maven-jar-plugin 特殊用法


编译构建red5 发现server jar包含了boot里面的类,覆盖默认jar-plugin的打包方式  注意颜色加粗的地方

 

<plugin>
				<artifactId>maven-jar-plugin</artifactId>
				<version>2.4</version>
				<executions>
					<execution>
						<id>default-jar</id>
						<phase>package</phase>
						<goals>
							<goal>jar</goal>
						</goals>
						<configuration>						
							<archive>
								<manifest>
									<addDefaultImplementationEntries>false</addDefaultImplementationEntries>
									<addDefaultSpecificationEntries>false</addDefaultSpecificationEntries> 
								</manifest>
								<manifestEntries>
									<SCM-Revision>${buildNumber}</SCM-Revision>
								</manifestEntries>
								<manifestEntries>
									<Red5-Version>${project.version}</Red5-Version>
								</manifestEntries>
							</archive>
							<excludes>
								<exclude>**/org/red5/server/Bootstrap.class</exclude>
								<exclude>**/org/red5/server/Shutdown.class</exclude>
								<exclude>**/org/red5/server/jmx/mxbeans/ShutdownMXBean.class</exclude>
								<exclude>**/org/red5/classloading/**</exclude>
							</excludes>
						</configuration>
					</execution>
					<execution>
						<id>bootstrap</id>
						<phase>package</phase>
						<goals>
							<goal>jar</goal>
						</goals>
						<configuration>
							<classifier>bootstrap</classifier>
							<archive>
								<manifest>
									<addDefaultImplementationEntries>false</addDefaultImplementationEntries>
									<mainClass>org.red5.server.Bootstrap</mainClass>
								</manifest>
								<manifestEntries>
									<SCM-Revision>${buildNumber}</SCM-Revision>
								</manifestEntries>
								<manifestEntries>
									<Red5-Version>${project.version}</Red5-Version>
								</manifestEntries>
							</archive>
							<includes>
								<include>**/org/red5/server/Bootstrap.class</include>
								<include>**/org/red5/server/Shutdown.class</include>
								<include>**/org/red5/server/jmx/mxbeans/ShutdownMXBean.class</include>
								<include>**/org/red5/classloading/**</include>
							</includes>
						</configuration>
					</execution>
				</executions>
			</plugin>

 


参考资料:

http://stackoverflow.com/questions/13061193/maven-generating-two-jar-files-when-used-with-classifier-tag

http://maven.apache.org/plugins/maven-jar-plugin/usage.html

 

你可能感兴趣的:(plugin)