MAVEN jar package, POM configuration

 
 <build>
		<finalName>brushwords</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
			</resource>
		</resources>
		<plugins>
			<!-- Ignore unit tests -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
			<!-- jar package plugin-->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>2.6 </version>
				<configuration>
					<archive>
						<manifest>
							<addClasspath>true</addClasspath>
							<!-- Use the jar package in the Maven repository -->
							<!-- <classpathPrefix>F:/Maven/Repository</classpathPrefix> <classpathLayoutType>repository</classpathLayoutType> -->
							<classpathPrefix>lib/</classpathPrefix>
                                         <!--Class with Main method, program execution entry-->
							<mainClass>com.hpc.brushwords.App</mainClass>
						</manifest>
					</archive>
				</configuration>
			</plugin>
			<!-- Copy the dependent jar package to the lib directory -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>copy</id>
						<phase>package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>
								${project.build.directory}/lib
							</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

 

 

MANIFEST.MF file, you can see that the Class-Path has been specified, and the Main-Class has also been specified

 

Manifest-Version: 1.0
Built-By: Administrator
Build-Jdk: 1.7.0_80
Class-Path: lib/httpclient-4.3.6.jar lib/httpcore-4.3.3.jar lib/common
 s-logging-1.1.3.jar lib/commons-codec-1.6.jar lib/jsoup-1.8.2.jar lib
 /fastjson-1.2.5.jar lib/commons-dbcp-1.4.jar lib/commons-pool-1.5.4.j
 ar lib / h2-1.3.176.jar lib / log4j-1.2.17.jar lib / slf4j-api-1.7.7.jar li
 b/slf4j-log4j12-1.7.7.jar
Created-By: Apache Maven 3.2.1
Main-Class: com.hpc.brushwords.App
Archiver-Version: Plexus Archiver

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326403952&siteId=291194637