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
  • 相关阅读:
    九度oj题目1019:简单计算器
    九度oj题目1555:重复子串
    Java泛型
    Remove Duplicates from Sorted Array
    Add Binary
    Plus One
    Remove Element
    Remove Nth Node From End of List
    Longest Common Prefix
    Roman to Integer
  • 原文地址:https://www.cnblogs.com/kongkongFabian/p/11262155.html
Copyright © 2011-2022 走看看