maven 打包 方式 war tar.gz

 

tar.gz

 

assembly/sendper5minutes.xml

 <packaging>jar</packaging>

<assembly 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/assembly-1.0.0.xsd">
	<formats>
		<format>tar.gz</format>
	</formats>
	<dependencySets>
		<dependencySet>
			<useProjectArtifact>true</useProjectArtifact>
			<outputDirectory>lib</outputDirectory>
		</dependencySet>
	</dependencySets>
	<fileSets>
		<fileSet>
			<directory>lib</directory>
			<outputDirectory>lib</outputDirectory>
			<includes>
			</includes>
		</fileSet>
		<fileSet>
			<directory>src/main/resources</directory>
			<outputDirectory>conf</outputDirectory>
			<includes>  
				<include>applicationContext.xml</include>
				<include>elasticsearch.properties</include>
				<include>hbase-site.xml</include>
				<include>jdbc.properties</include>
				<include>log4j.xml</include>
				<include>rabbit-producer-context.xml</include>
				<include>rabbitmq.properties</include>
				<include>service.properties</include> 
			</includes>
		</fileSet>
		<fileSet>
			<directory>sh</directory>
			<outputDirectory>sh</outputDirectory>
			<includes> 
				<include>senddwrper5minutes.sh</include>
			</includes>
			<lineEnding>unix</lineEnding>
			<fileMode>0744</fileMode>
			<directoryMode>0644</directoryMode>
		</fileSet>
	</fileSets>
</assembly>

 

 assembly/war.xml

 

<assembly 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/assembly-1.0.0.xsd">
  <id>assembly</id>
  <formats>
    <format>war</format>
    <format>dir</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets> 
   <dependencySet>
      <outputDirectory>WEB-INF/lib</outputDirectory>
      <useProjectArtifact>false</useProjectArtifact>
    </dependencySet>    
  </dependencySets>
  <fileSets>
	<fileSet>
      <directory>${project.build.outputDirectory}</directory>
      <outputDirectory>WEB-INF/classes</outputDirectory>
    </fileSet> 
    <fileSet>
      <directory>src/main/assembly/bin</directory>
      <outputDirectory>WEB-INF/classes/lib</outputDirectory>
      <fileMode>0755</fileMode>
    </fileSet> 
    <fileSet>
      <directory>${project.basedir}/src/main/webapp</directory>
      <outputDirectory>/</outputDirectory>
    </fileSet>
  </fileSets>  
</assembly>

 

 

 

pom 

 

<packaging>war</packaging>

 

<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.2-beta-2</version>
				
				<executions>
				<execution>
						<id>make-tar.gz</id>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
					<configuration>
					    <skipAssembly>false</skipAssembly> 
					    <appendAssemblyId>false</appendAssemblyId>
						<finalName>${project.artifactId}_senddwrper5minutes</finalName>
						<descriptors>
							<descriptorRef>assembly/sendper5minutes.xml</descriptorRef>
						</descriptors>
					</configuration> 
					</execution>
					<execution>
					    <id>make-war</id>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
						<configuration>
						    <skipAssembly>false</skipAssembly> 
						    <appendAssemblyId>false</appendAssemblyId>
							<finalName>${project.artifactId}_maven_assembly_plugin</finalName>
							<descriptors>
								<descriptorRef>assembly/war.xml</descriptorRef>
							</descriptors>
							</configuration>
					</execution>
				</executions>
			</plugin> 

 以上 包含 assembly 打war  包

 

 

第二种 war 

 

<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>2.6</version>
				<configuration>
					<packagingExcludes>
						WEB-INF/lib/servlet-api*.jar,WEB-INF/lib/jsp-api-*.jar,WEB-INF/lib/jsp-2.1-*.jar,WEB-INF/lib/*-7.0.54.jar,WEB-INF/lib/*-5.5.23.jar
					</packagingExcludes>
					<webResources>
						<resource>
							<directory>sql</directory>
							<includes>
								<include>self_helper/*.sql</include>
							</includes>
						</resource>
					</webResources>
				</configuration>
				<executions>
					<execution>
						<id>my-war</id>
						<phase>war</phase>
						<goals>
							<goal>war</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

捐助开发者

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。



 
 
 谢谢您的赞助,我会做的更好!

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值