maven常用插件-打包
程序员文章站
2022-03-04 17:21:33
...
jar包
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <classpathPrefix>lib/</classpathPrefix> <mainClass>com.xxx.windfarmconfigtool.FrontConfigMain</mainClass> <!-- <useUniqueVersions>false</useUniqueVersions> --> </manifest> <manifestEntries> <Class-Path>./</Class-Path> </manifestEntries> </archive> </configuration> </plugin>
归档文件:
<plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptors> <descriptor>src/main/resources/config/package-frontconfig.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin>
<?xml version="1.0" encoding="UTF-8"?> <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> <id>package</id> <formats> <format>zip</format> </formats> <includeBaseDirectory>true</includeBaseDirectory> <fileSets> <fileSet> <directory>src/main/resources</directory> <outputDirectory>/</outputDirectory> <!-- <includes> <include>config/log4j.properties</include> <include>frontconfig/*</include> </includes> --> </fileSet> <fileSet> <directory>${project.build.directory}</directory> <outputDirectory>/</outputDirectory> <includes> <include>*.exe</include> <include>*.jar</include> </includes> </fileSet> </fileSets> <dependencySets> <dependencySet> <outputDirectory>lib</outputDirectory> <scope>runtime</scope> <!-- <unpack>false</unpack> --> <excludes> <!-- <exclude>${project.name}-${project.version}</exclude> --> <exclude>${groupId}:${artifactId}</exclude> </excludes> </dependencySet> </dependencySets> </assembly>
exe:
<plugin> <groupId>org.bluestemsoftware.open.maven.plugin</groupId> <artifactId>launch4j-plugin</artifactId> <version>1.5.0.0</version> <executions> GUI exe <execution> <id>l4j-gui</id> <phase>package</phase> <goals> <goal>launch4j</goal> </goals> <configuration> <headerType>gui</headerType> <outfile>target/${artifactId}-${version}.exe</outfile> <downloadUrl>https://java.com/en/download/manual.jsp</downloadUrl> <jar>target/${artifactId}-${version}.jar</jar> 'shaded' is the value set on shadedClassifierName above <errTitle>App Err</errTitle> <classPath> <mainClass>com.xxx.windfarmconfigtool.Main</mainClass> <addDependencies>true</addDependencies> <jarLocation>target/lib</jarLocation> <preCp>lib/*.jar</preCp> </classPath> <icon>src/main/resources/icons/application.ico</icon> <jre> <minVersion>1.8.0</minVersion> <maxVersion>1.6.0</maxVersion> <initialHeapSize>128</initialHeapSize> <maxHeapSize>1024</maxHeapSize> <path>C:\Program Files\Java\jre1.8.0_101\bin</path> <bundledJre64Bit>true</bundledJre64Bit> <bundledJreAsFallback>true</bundledJreAsFallback> <jdkPreference>jdkOnly</jdkPreference> <runtimeBits>64</runtimeBits> </jre> <versionInfo> <fileVersion>1.0.0.0</fileVersion> <txtFileVersion>1.0.0.0</txtFileVersion> <fileDescription>xxx</fileDescription> <copyright>xxx</copyright> <productVersion>1.0.0.0</productVersion> <txtProductVersion>1.0.0.0</txtProductVersion> <productName>${artifactId}-${version}</productName> <internalName>${artifactId}-${version}</internalName> <originalFilename>${project.name }.exe</originalFilename> </versionInfo> <messages> <startupErr>text</startupErr> <bundledJreErr>text</bundledJreErr> <jreVersionErr>text</jreVersionErr> <launcherErr>text</launcherErr> Used by console header only. <instanceAlreadyExistsMsg>text</instanceAlreadyExistsMsg> </messages> </configuration> </execution> </executions> </plugin>
推荐阅读
-
详解eclipse中Maven工程使用Tomcat7以上插件的方法
-
详解如何在css3打包后自动追加前缀插件:autoprefixer
-
使用Maven Archetype插件构建Maven工程原型模板的实例
-
Android Studio常用设置(设置ide主题、安装插件、设置编码区字体、自定义sdk位置)
-
Webpack 常用命令总结以及常用打包压缩方法
-
Sublime Text 3 常用插件以及安装方法(图文)
-
Sublime快捷键与常用插件配置总结
-
Spring Boot Maven 打包可执行Jar文件的实现方法
-
29个常用 Sublime Text 插件推荐
-
vscode常用插件整理汇总