maven-configuration
Used in:
components
- OverviewOverview
- VersionsVersions
- DependentsDependents
- DependenciesDependencies
<dependency> <groupId>com.kongseek</groupId> <artifactId>maven-configuration</artifactId> <version>2.0.0</version> </dependency>
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.kongseek</groupId> <artifactId>maven-configuration</artifactId> <version>2.0.0</version> <packaging>pom</packaging> <organization> <name>kongseek.com</name> <url>https://kongseek.com</url> </organization> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!--配置插件执行变量--> <!--maven发布-是否跳过执行--> <skipPublish>true</skipPublish> <!--打包exe-是否跳过执行--> <skipPackageExe>true</skipPackageExe> <exeJarSuffix>jar-with-dependencies</exeJarSuffix> <!--打包exe-输出目录--> <exeOutputDir>${project.basedir}/target/exe</exeOutputDir> <!--打包exe-输出文件名--> <exeOutputName>${project.artifactId}-${project.version}.exe</exeOutputName> <!--打包exe-文件描述--> <exeFileDescription>there is nothing</exeFileDescription> <!--打包exe-主类--> <exeMainClass>com.kongseek.Main</exeMainClass> <!--打包exe-类型(console/gui)--> <exeType>console</exeType> <gpg.keyname>${env.GPG_KEY_ID}</gpg.keyname> <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase> </properties> <!--maven发布要求属性(随意填写,不检查可用性)--> <name>${project.groupId}:${project.artifactId}</name> <description>这是一个maven常用的插件配置文件</description> <url>https://kongseek.com</url> <licenses> <license> <name>The Apache Software License, Version 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> </license> </licenses> <developers> <developer> <id>kongshan4219</id> <name>空山寻痕</name> </developer> </developers> <scm> <connection>https://kongseek.com</connection> <developerConnection>https://kongseek.com</developerConnection> <url>https://kongseek.com</url> </scm> <!--maven发布要求属性end--> <distributionManagement> <repository> <id>2448178-release-Me2Ctn</id> <url>https://packages.aliyun.com/659cb6c2ca53b3c44b21289d/maven/2448178-release-me2ctn</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </distributionManagement> <build> <plugins> <!--maven发布-源代码打包--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.2.1</version> <configuration> <skipSource>${skipPublish}</skipSource> </configuration> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin> <!--maven发布-javadoc文档打包--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>3.11.2</version> <configuration> <skip>${skipPublish}</skip> <encoding>UTF-8</encoding> <docencoding>UTF-8</docencoding> <charset>UTF-8</charset> <failOnError>true</failOnError> </configuration> <executions> <execution> <id>attach-javadocs</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <!--maven发布-源码和javadoc文档签名--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-gpg-plugin</artifactId> <version>1.5</version> <configuration> <skip>${skipPublish}</skip> <keyname>${gpg.keyname}</keyname> <passphrase>${gpg.passphrase}</passphrase> <gpgArguments> <arg>--batch</arg> <arg>--pinentry-mode</arg> <arg>loopback</arg> </gpgArguments> <useAgent>false</useAgent> </configuration> <executions> <execution> <id>sign-artifacts</id> <phase>verify</phase> <goals> <goal>sign</goal> </goals> </execution> </executions> </plugin> <!--maven发布-上传到中央仓库--> <plugin> <groupId>org.sonatype.central</groupId> <artifactId>central-publishing-maven-plugin</artifactId> <version>0.7.0</version> <extensions>true</extensions> <configuration> <skipPublishing>${skipPublish}</skipPublishing> <publishingServerId>${project.artifactId}</publishingServerId> <deploymentName>${project.artifactId}-${project.version}</deploymentName> <autoPublish>true</autoPublish> </configuration> </plugin> <!--maven发布到阿里云私有仓库--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> <configuration> <altReleaseDeploymentRepository> 2448178-release-Me2Ctn::default::https://packages.aliyun.com/659cb6c2ca53b3c44b21289d/maven/2448178-release-me2ctn </altReleaseDeploymentRepository> </configuration> </plugin> <!--打包exe-打包单个包含所有依赖的jar包 --> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>3.7.1</version> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <!-- 必须指定描述符或格式 --> <descriptorRefs> <descriptorRef>${exeJarSuffix}</descriptorRef> </descriptorRefs> <!-- 主类配置 --> <archive> <manifest> <mainClass>${exeMainClass}</mainClass> </manifest> </archive> </configuration> </execution> </executions> </plugin> <!--打包exe-生成jre--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>3.1.0</version> <dependencies> <dependency> <groupId>ant-contrib</groupId> <artifactId>ant-contrib</artifactId> <version>1.0b3</version> <exclusions> <exclusion> <groupId>ant</groupId> <artifactId>ant</artifactId> </exclusion> </exclusions> </dependency> </dependencies> <executions> <execution> <id>generate-jre</id> <phase>prepare-package</phase> <goals> <goal>run</goal> </goals> <configuration> <skip>${skipPackageExe}</skip> <target> <!-- 引入Ant-Contrib --> <taskdef resource="net/sf/antcontrib/antcontrib.properties"/> <!-- 临时生成目录(JDK安装路径下的jre) --> <property name="tempJreDir" value="${env.JAVA_HOME}/jre"/> <!-- 最终目标目录 --> <property name="finalJreDir" value="${exeOutputDir}/jre"/> <!-- 检查临时目录是否存在 --> <if> <not> <available file="${env.JAVA_HOME}/jre" type="dir"/> </not> <then> <!-- 生成JRE到临时目录 --> <exec executable="${env.JAVA_HOME}/bin/jlink" failonerror="true"> <arg value="--module-path"/> <arg value="${env.JAVA_HOME}/jmods"/> <arg value="--add-modules"/> <arg value="java.base,java.desktop,java.logging"/> <arg value="--output"/> <arg value="${env.JAVA_HOME}/jre"/> <arg value="--strip-debug"/> <arg value="--no-man-pages"/> <arg value="--no-header-files"/> </exec> <echo message="Generated temporary JRE at ${env.JAVA_HOME}/jre"/> </then> <else> <echo message="Temporary JRE directory already exists, skipping generation."/> </else> </if> <!-- 复制到最终目录 --> <if> <not> <available file="${exeOutputDir}/jre" type="dir"/> </not> <then> <echo message="Copying JRE to ${exeOutputDir}/jre..."/> <mkdir dir="${exeOutputDir}/jre"/> <copy todir="${exeOutputDir}/jre"> <fileset dir="${env.JAVA_HOME}/jre"/> </copy> </then> <else> <echo message="Final JRE directory already exists, skipping copy."/> </else> </if> </target> </configuration> </execution> </executions> </plugin> <!--打包exe-构建exe文件--> <plugin> <groupId>com.akathist.maven.plugins.launch4j</groupId> <artifactId>launch4j-maven-plugin</artifactId> <version>2.5.2</version> <executions> <execution> <id>l4j-clui</id> <phase>package</phase> <goals> <goal>launch4j</goal> </goals> <configuration> <headerType>${exeType}</headerType> <cmdLine>-Dfile.encoding=UTF-8</cmdLine> <cmdLine>-Dsun.stdout.encoding=UTF-8</cmdLine> <cmdLine>-Dsun.stderr.encoding=UTF-8</cmdLine> <stayAlive>false</stayAlive> <outfile>${exeOutputDir}/${exeOutputName}</outfile> <jar>${project.build.directory}/${project.artifactId}-${project.version}-${exeJarSuffix}.jar</jar> <errTitle>${project.artifactId}</errTitle> <classPath> <mainClass>${exeMainClass}</mainClass> <addDependencies>true</addDependencies> <preCp>anything</preCp> </classPath> <!-- 动态绑定项目级 JRE --> <jre> <path>./jre</path> <requiresJdk>false</requiresJdk> <minVersion>${java.version}</minVersion> </jre> <!-- 版本信息动态绑定 --> <versionInfo> <fileDescription>${exeFileDescription}</fileDescription> <originalFilename>${exeOutputName}</originalFilename> </versionInfo> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>