zoukankan      html  css  js  c++  java
  • maven打包

    1. 普通打包

    只打包源代码,不包含所使用的jar包

    1.1 pom 配置

    <build>
        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
          <plugins>
            <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>UTF-8</encoding>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>

    1.2 打包命令

    mvn clean package -D maven.test.skip=true

    2.包含pom中所有jar的打包

    2.1 pom 配置

    <build>
        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
          <plugins>
            <plugin>
              <artifactId>maven-assembly-plugin</artifactId>
              <configuration>
                <!--这部分可有可无,加上的话则直接生成可运行jar包-->
                <!--<archive>-->
                <!--<manifest>-->
                <!--<mainClass>${exec.mainClass}</mainClass>-->
                <!--</manifest>-->
                <!--</archive>-->
                <descriptorRefs>
                  <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>

    2.2 打包命令

    mvn assembly:assembly
  • 相关阅读:
    Gradle gitignore Gradle 模式 上传SVN 要忽略的文件
    加速Android Studio/Gradle构建
    JAVA unicode转换成中文
    进程与线程
    Flask快速入门
    tensorflow入门指南
    BP神经网络与Python实现
    文档数据库MongoDB
    Python虚拟环境virtualenv
    Python爬虫框架Scrapy
  • 原文地址:https://www.cnblogs.com/kongkongFabian/p/11262155.html
Copyright © 2011-2022 走看看