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配配置中增加