最近写一个客户端sdk,需要把依赖的jar包都打到生成的jar包里
pom文件添加
<plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass></mainClass> </manifest> </archive> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin>
target目录会生成-with-dependencies.jar结尾的文件,该jar包就包含了所有依赖的jar包,可以单独运行了。
时间: 2024-11-09 23:15:32