zoukankan      html  css  js  c++  java
  • 搬运_maven打包

    参考文章

    • 利用Maven插件将依赖包、jar/war包及配置文件输出到指定目录

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <!--${project.build.directory} class的输出目录不做设置的话默认代表项目根目录的target目录;
                                也可以使用“自定义文件夹/自定义文件夹 例如:a/b”,也可以使用绝对路径如:“D:	est” -->
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            <excludeTransitive>false</excludeTransitive>
                            <stripVersion>false</stripVersion>
                            <includeScope>runtime</includeScope>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    • 打Jar包时,与此类似

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
            <outputDirectory>d:	est</outputDirectory>
            <!--表示将所有的webapps项目下的文件拷贝到相应路径-->
            <webappDirectory>d:	est</webappDirectory>
        </configuration>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <!-- 指定打包的jar包输出路径-->
            <outputDirectory>
                ${project.build.directory}/lib
            </outputDirectory>   
            <!--不打入jar包的文件类型或者路径-->
            <excludes>
                <exclude>**/*.properties</exclude>
                <exclude>**/*.xml</exclude>
                <exclude>**/*.yml</exclude>
                <exclude>static/**</exclude>
                <exclude>templates/**</exclude>
            </excludes>
        </configuration>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
            <execution>
                <id>copy-resources</id>
                <phase>package</phase>
                <goals>
                    <goal>copy-resources</goal>
                </goals>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <!--打成jar包后复制到的路径-->
                    <outputDirectory>
                        ${project.build.directory}/conf
                    </outputDirectory>  
                    <resources>
                        <resource>
                            <!--项目中的路径-->
                            <directory>src/main/resources/</directory>
                        </resource>
                    </resources>
                </configuration>
            </execution>
            <!--可配置多个提取复制路径只需要 “<id>”名字不一样即可-->
            <execution>
                <id>copy-bulid</id>
                <phase>package</phase>
                <goals>
                    <goal>copy-resources</goal>
                </goals>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <outputDirectory>
                        ${project.build.directory}/bin
                    </outputDirectory>   
                    <resources>
                        <resource>
                            <directory>build/</directory>
                        </resource>
                    </resources>
                </configuration>
            </execution>
        </executions>
    </plugin>
  • 相关阅读:
    数组常用遍历方法总结
    文本控制行数,超出省略号显示
    数据结构入门
    数论函数补充 公式推导
    几何入门合集 gym101968 problem F. Mirror + gym102082 Problem F Fair Chocolate-Cutting + gym101915 problem B. Ali and Wi-Fi
    COCI 2018/2019 CONTEST #2 T4 Maja T5Sunčanje Solution
    数论函数
    数论入门
    USACO1.4 1.5 搜索剪枝与数字 洛谷OJ P1214 P1215 P1217 P1218
    USACO Section 1.3 题解 (洛谷OJ P1209 P1444 P3650 P2693)
  • 原文地址:https://www.cnblogs.com/donfaquir/p/10385556.html
Copyright © 2011-2022 走看看