Packaged in two ways

Method 1:
(1) generating a running mvn clean package-Product-1.0.0.jar Mall 
(2) run mvn dependency: copy-dependencies copy item jar package to the default path target / dependency
(. 3) new folder product / lib the (1) and the jar (2) in the folder, the following copying jar
(4) run command console (into the new folder, lib outside) D: \ Workspaces2 \ product> java -Djava. ext.dirs = lib com.edu.spring.mall.product.App

 method 2:

Add the following plug-in pom.xml file

<Build>
<plugins>
<-! http://www.mojohaus.org/appassembler/appassembler-maven-plugin/index.html ->
<plugin>
<the groupId> org.codehaus.mojo </ the groupId>
< artifactId> appassembler-Maven-plugin </ artifactId>
<Version> 1.2.1 </ Version>
<the Configuration>
<-! generation linux, windows on both platforms perform script ->
<platforms>
<platform> Windows </ Platform>
<Platform> UNIX </ Platform>
</ Platforms>
<-! root ->
<assembleDirectory>} $ {project.build.directory / Product </ assembleDirectory>
<-! packaged jar, and maven dependent jar into the directory ->
<RepositoryName> lib </ RepositoryName>
<-! Executable scripts directory ->
<binFolder> bin </ binFolder>
<! - the target directory profile ->
<configurationDirectory> the conf </ configurationDirectory>
<-! copy the configuration file to the above directory ->
<copyConfigurationDirectory> to true </ copyConfigurationDirectory>
<-! copying configurations where (default src / main / config) - >
<configurationSourceDirectory> the src / main / Resources </ configurationSourceDirectory>
<-! lib directory storage jar rule, the default is $ {groupId} / $ {artifactId } directory format, flat into the jar directly represents directory lib - ->
<repositoryLayout> Flat </ repositoryLayout>
<encoding> UTF-. 8 </ encoding>
<logsDirectory> logs </ logsDirectory>
<tempDirectory> tmp </ tempDirectory>
<Programs>
<Program>
<-! start classes - >
<mainClass> com.edu.spring.mall.product.App </ mainClass>
<jvmSettings>
<extraArguments>
<additional argument> server </ extra argument>
<extraArgument>-Xmx1G</extraArgument>
<extraArgument>-Xms1G</extraArgument>
</extraArguments>
</jvmSettings>
</program>
</programs>
</configuration>
</plugin>
</plugins>
</build>

Use maven plugin mvn appassembler: assemble

Guess you like

Origin www.cnblogs.com/javasl/p/11161608.html