Specifies the main class when maven package

The default package is generated jar, if my project as well as the main method, I would like to be packaged into an executable jar package, in order to generate executable jar file, it needs maven-shade-plugin, configure the plug. 

<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
				<version>1.2.1</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>shade</goal>
						</goals>
						<configuration>
							<transformers>
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
									<mainClass>com.yc.yc74zk.projects.zkPro.bean2.monitorServers.DataNodeServer</mainClass>
								</transformer>
							</transformers>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

 

Published 107 original articles · won praise 29 · views 180 000 +

Guess you like

Origin blog.csdn.net/zhangyingchengqi/article/details/104590279