zoukankan      html  css  js  c++  java
  • Maven打jar包(有依赖)

    1、前言

    参考 Idea 使用问题记录
    项目需要给调用者提供jar包调用,且含有log4j等依赖

    2、引用本地jar包

            <!--使用本地jar-->
            <dependency>
                <groupId>com.bjlthy</groupId>
                <artifactId>LogUtil</artifactId>
                <version>1.0</version>
                <scope>system</scope>
                <systemPath>${basedir}/lib/logUtils.jar</systemPath>
            </dependency>
    

    3、pom文件

        <groupId>com.logUtil</groupId>
        <artifactId>logUtil</artifactId>
        <version>1.0</version>
        <name>logUtil</name>
    	
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <configuration>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <appendAssemblyId>false</appendAssemblyId>
                        <archive>
                            <manifest>
                                <mainClass>主类</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                    <executions>
                        <execution>
                            <id>make-assembly</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    

    4、去掉依赖后缀

    参考maven打包指定名称并去除jar-with-dependencies后缀
    在mavne中打包默认的一般为artifactId.{version}.${packageing},有些时候需要指定maven打包的名称,可以进行如下配置:
    在pom.xml中build配配置中增加yourName,如果想去除jar-with-dependencies后缀,则在assembly配置中增加false

  • 相关阅读:
    13.6 线程通信
    13.5 线程同步
    13.4 控制线程
    13.3 线程的生命周期
    13.2 线程的创建与启动
    13.1 线程概述
    12.10 NIO.2的功能和用法
    bs4
    mysql基本命令
    HDU-1021 Fibonacci Again
  • 原文地址:https://www.cnblogs.com/kikyoqiang/p/14431403.html
Copyright © 2011-2022 走看看