zoukankan      html  css  js  c++  java
  • maven项目打ZIP包

    1、Maven插件配置:

    	<!-- ZIP打包 -->
    		<plugin>
    				<artifactId>maven-assembly-plugin</artifactId>
    				<configuration>
    					<descriptors>
    						<descriptor>assembly/assembly.xml</descriptor>
    					</descriptors>
    				</configuration>
    				<executions>
    					<execution>
    						<id>assemble-zip</id>
    						<goals>
    							<goal>single</goal>
    						</goals>
    						<phase>package</phase>
    					</execution>
    				</executions>
    			</plugin>
    

      assembly.xml配置:

    <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
        <id>distribution</id>
        <formats>
            <format>zip</format>
        </formats>
        <fileSets>
            <fileSet>
                <directory>${project.basedir}/src/main/resources</directory>
                <outputDirectory>/etc/</outputDirectory>
            </fileSet>
            <fileSet>
                <directory>${project.basedir}/sbin</directory>
                <outputDirectory>/sbin</outputDirectory>
                 <lineEnding>unix</lineEnding>
            </fileSet>
        </fileSets>
        <dependencySets>
            <dependencySet>
                <useProjectArtifact>true</useProjectArtifact>
                <outputDirectory>lib</outputDirectory>
                <!-- 将scope为runtime的依赖包打包到lib目录下。 -->
                <scope>runtime</scope>
            </dependencySet>
        </dependencySets>
    </assembly>
    

     2、 maven打包运行主类:

    <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <executions>
    						<execution>
    							<goals>
    								<goal>repackage</goal>
    							</goals>
    						</execution>
    					</executions>
    					<configuration>
    					<!-- 运行主类,如果只有一个时可以不用配置,有多个时配置。 -->
                        <!-- <mainClass>${start-class}</mainClass> -->
    					</configuration>
                </plugin>
    

      

  • 相关阅读:
    极客教学笔记---Java实现简单聊天客户端模拟
    java单例模式四模板
    关于在命令行进行文件输入输出重定向的小笔记
    Python爬虫入门之爬取图片
    Python爬虫入门之查询ip地址
    Python爬虫入门之get网页信息并作为文本输出
    Checker
    Manacher模板
    POJ3974——Palindrome
    Seek the Name, Seek the Fame
  • 原文地址:https://www.cnblogs.com/tietazhan/p/6656598.html
Copyright © 2011-2022 走看看