zoukankan      html  css  js  c++  java
  • maven 常用插件 拷贝依赖 拷贝jar包 查看属性 环境变量

    1 maven编译后希望将生产的jar包拷贝到指定目录

     在pom中配置maven插件

    maven-antrun-plugin
     <build >
            <plugins>
                <plugin>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>copy-lib-src-webapps</id>
                            <phase>package</phase>
                            <configuration>
                                <tasks>
                                    <!-- <delete dir="src/main/webapp/WEB-INFb" />-->
                                    <copy todir="F:jarlibs">
                                        <fileset dir="${env.ACCOUNTINGDOCUMENT_JAVA_PATH}fi-gl-accountingdocument-core	arget">
                                            <include name="fi-gl-accountingdocument-core-1.0-SNAPSHOT.jar" />
                                        </fileset>
                                    </copy>
                                </tasks>
                            </configuration>
                            <goals>
                                <goal>run</goal>
                            </goals>
                        </execution>                    
                    </executions>
                </plugin>
            </plugins>
        </build>

    2 希望使用内置属性 ${properties.property} 方便项目协作

     但不清楚有哪些properties 没找到简单的查看properties的方法

     增加配置节点 执行validate 控制台会打印具体的properties

    <execution>
                            <phase>validate</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                            <configuration>
                                <tasks>
                                    <echoproperties />
                                </tasks>
                            </configuration>
    </execution>

    如 想将生成的jar包拷贝到F:jarlibs

    <build >
            <plugins>
                <plugin>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>copy-lib-src-webapps</id>
                            <phase>package</phase>
                            <configuration>
                                <tasks>
                                    <!-- <delete dir="src/main/webapp/WEB-INFb" />-->
                                    <copy todir="F:jarlibs">
                                        <fileset dir="${project.build.directory}">
                                            <include name="${project.artifactId}-${project.version}.jar" />
                                        </fileset>
                                    </copy>
                                </tasks>
                            </configuration>
                            <goals>
                                <goal>run</goal>
                            </goals>
                        </execution>
    <!--                    <execution>-->
    <!--                        <phase>validate</phase>-->
    <!--                        <goals>-->
    <!--                            <goal>run</goal>-->
    <!--                        </goals>-->
    <!--                        <configuration>-->
    <!--                            <tasks>-->
    <!--                                <echoproperties />-->
    <!--                            </tasks>-->
    <!--                        </configuration>-->
    <!--                    </execution>-->
                    </executions>
                </plugin>
    
            </plugins>
    
    
        </build>

     3 拷贝依赖到制定文件夹

    includeGroupIds过滤拷贝的groupid
    <properties>
            <project.targetDir>D:jar</project.targetDir>
            <project.targetServerDir>\localhostc$jar</project.targetServerDir>
        </properties>
        <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>
                                <includeGroupIds>com.inspur.gs</includeGroupIds>
                                <outputDirectory>${project.targetDir}</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>

    参考:

    https://stackoverflow.com/questions/12317609/maven-overview-for-the-values-of-maven-properties

    https://books.sonatype.com/mvnref-book/reference/resource-filtering-sect-properties.html

    http://www.avajava.com/tutorials/lessons/how-do-i-display-the-value-of-a-property.html

      

  • 相关阅读:
    域渗透:ptk(pass the key)
    QQ拼音输入法6.0 DLL劫持实现提权
    进程关系
    进程控制
    进程环境
    系统数据文件和信息
    文件和目录
    标准I/O
    文件描述符标志/文件表项
    SSL安全原理
  • 原文地址:https://www.cnblogs.com/wolbo/p/11451058.html
Copyright © 2011-2022 走看看