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>
  • 相关阅读:
    ArchLinux and LXDE and LXDM
    如何改变X:\Users\XXX的用户名称
    Windows 7 支持4GB以上内存破解工具下载
    Linux & Vim Command Wallpaper
    The easy way to execute sudo command in Python using subprocess.Popen
    C# DateTime 精确到秒/截断毫秒部分
    制约程序员"钱途"的两大最关键因素
    Oracle基本操作
    字符串处理【Delphi版】
    java学习路线的经验之谈
  • 原文地址:https://www.cnblogs.com/donfaquir/p/10385556.html
Copyright © 2011-2022 走看看