欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Maven打jar包,并将依赖包打进去

程序员文章站 2022-06-18 17:15:58
...
<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.4</version>
				<configuration>
					<appendAssemblyId>false</appendAssemblyId>
					<finalName>searchIndex</finalName>
					<descriptorRefs>
<!-- 将依赖的jar包中的class文件打进生成的jar包-->
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
					<archive>
						<manifest>
							<addClasspath>true</addClasspath>
<!-- 有Main函数的类-->
							<mainClass>com.yourcompany.yourproject.MainClass</mainClass>
						</manifest>
					</archive>
				</configuration>
				<executions>
					<execution>
						<id>make-assembly</id>
						<phase>package</phase>
						<goals>
<!-- <goal>single</goal>-->
							<goal>assembly</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

 

 

转载于:https://my.oschina.net/u/1167421/blog/546463