• pom.xml配置实例


    maven-compiler-plugin

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <!-- 常用配置示例、说明 -->
        <configuration>
            <!-- 源代码使用的JDK版本 -->
            <source>8</source>
            <!-- 需要生成的目标class文件的编译版本 -->
            <target>8</target>
            <!-- 字符集编码 -->
            <encoding>UTF-8</encoding>
            <!-- 跳过测试 -->
            <skipTests>true</skipTests>
            <!-- 这个选项用来传递编译器自身不包含但是却支持的参数选项 -->
            <!--<compilerArgument>-verbose -bootclasspath ${java.home}lib
    t.jar</compilerArgument>-->
        </configuration>
    </plugin>
    

    maven-dependency-plugin

    <!-- https://www.cnblogs.com/hqzmss/p/9837396.html -->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
            <!-- 将指定artifact复制到指定目录 -->
            <!-- http://maven.apache.org/components/plugins/maven-dependency-plugin/copy-mojo.html -->
            <execution>
                <id>copy-installed</id>
                <phase>package</phase>
                <goals>
                    <goal>copy</goal>
                </goals>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>${project.artifactId}</artifactId>
                            <version>${project.version}</version>
                            <type>${project.packaging}</type>
                        </artifactItem>
                    </artifactItems>
                    <outputDirectory>target/lib</outputDirectory>
                </configuration>
            </execution>
            <!-- 将依赖jar包复制到特定目录 -->
            <!-- http://maven.apache.org/components/plugins/maven-dependency-plugin/copy-dependencies-mojo.html -->
            <execution>
                <id>copy-lib</id>
                <phase>prepare-package</phase>
                <goals>
                    <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                    <outputDirectory>${project.build.directory}/lib</outputDirectory>
                    <overWriteReleases>false</overWriteReleases>
                    <overWriteSnapshots>false</overWriteSnapshots>
                    <overWriteIfNewer>true</overWriteIfNewer>
                    <includeScope>compile</includeScope>
                </configuration>
            </execution>
        </executions>
    </plugin>
    

    maven-assembly-plugin

    简单使用:带依赖的可执行jar包

    <!-- https://www.cnblogs.com/linjiqin/p/10091113.html -->
    <!-- 打包命令:mvn assembly:assembly -->
    <!-- 如果上面的命令成功执行,那么在项目路径的target文件下就会有两个jar文件,一个是有jar包依赖的,一个是没jar包依赖的 -->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
            <archive>
                <manifest>
                    <mainClass>netty.http.Demo02</mainClass>
                </manifest>
            </archive>
            <descriptorRefs>
                <descriptorRef>
                    jar-with-dependencies
                </descriptorRef>
            </descriptorRefs>
        </configuration>
    </plugin>
    

    个性化定制

    
    
  • 相关阅读:
    Codeforces 723d [暴力dfs]
    Codeforces 723e [图论][欧拉回路]
    Hihocoder 1035 [树形dp]
    Codeforces 721C [dp][拓扑排序]
    Codeforces 721D [贪心]
    info
    关于string操作
    Floyd求最小环 HDU1599
    Codeforces Round #572 (Div. 2) B Number Circle
    A. XXXXX
  • 原文地址:https://www.cnblogs.com/CSunShine/p/12401860.html
Copyright © 2020-2023  润新知