chore(pom): 更新Maven配置以支持中央仓库发布- 移除maven-assembly-plugin、maven-source-plugin和maven-javadoc-plugin配置
- 替换nexus-staging-maven-plugin为central-publishing-maven-plugin - 更新GPG插件配置,指定可执行文件路径和参数 - 添加阿里云Maven仓库以加速依赖下载- 移除distributionManagement配置,使用新的发布方式 - 简化注释并优化插件配置结构
This commit is contained in:
@@ -64,34 +64,33 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>central</id>
|
||||||
|
<url>https://maven.aliyun.com/repository/central</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>central</id>
|
||||||
|
<url>https://maven.aliyun.com/repository/central</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- Maven Assembly Plugin - 用于创建包含所有依赖的jar包 -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
|
||||||
<version>3.6.0</version>
|
|
||||||
<configuration>
|
|
||||||
<descriptorRefs>
|
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
|
||||||
</descriptorRefs>
|
|
||||||
<archive>
|
|
||||||
<manifest>
|
|
||||||
<!-- 在这里可以设置mainClass,如果您的项目有主类的话 -->
|
|
||||||
<!-- <mainClass>com.yourcompany.MainClass</mainClass> -->
|
|
||||||
</manifest>
|
|
||||||
</archive>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>make-assembly</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>single</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!-- Maven Compiler Plugin - 确保使用正确的Java版本编译 -->
|
<!-- Maven Compiler Plugin - 确保使用正确的Java版本编译 -->
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -104,43 +103,6 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- Maven Source Plugin - 生成源码jar -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
|
||||||
<version>3.3.0</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>attach-sources</id>
|
|
||||||
<goals>
|
|
||||||
<goal>jar</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!-- Maven Javadoc Plugin - 生成javadoc jar -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
|
||||||
<version>3.5.0</version>
|
|
||||||
<configuration>
|
|
||||||
<doclint>none</doclint> <!-- 避免javadoc严格检查导致的警告 -->
|
|
||||||
<source>11</source>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
<charset>UTF-8</charset>
|
|
||||||
<docencoding>UTF-8</docencoding>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>attach-javadocs</id>
|
|
||||||
<goals>
|
|
||||||
<goal>jar</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!-- Maven GPG Plugin - 用于签名构件 -->
|
<!-- Maven GPG Plugin - 用于签名构件 -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@@ -158,97 +120,33 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<!-- 使用环境变量中的gpg密钥密码 -->
|
<!-- 使用环境变量中的gpg密钥密码 -->
|
||||||
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
|
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
|
||||||
<!-- 避免在CI/CD中使用交互模式 -->
|
<!-- 指定GPG可执行文件路径 -->
|
||||||
<useAgent>false</useAgent>
|
<executable>gpg</executable>
|
||||||
|
<!-- 使用默认密钥 -->
|
||||||
|
<useAgent>true</useAgent>
|
||||||
|
<!-- 设置gpg主目录 -->
|
||||||
|
<gpgArguments>
|
||||||
|
<arg>--pinentry-mode</arg>
|
||||||
|
<arg>loopback</arg>
|
||||||
|
</gpgArguments>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- Maven Nexus Staging Plugin - 用于部署到Maven Central -->
|
<!-- Central Publishing Plugin - 发布到Maven Central -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
<groupId>org.sonatype.central</groupId>
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
<artifactId>central-publishing-maven-plugin</artifactId>
|
||||||
<version>1.6.13</version>
|
<version>0.9.0</version>
|
||||||
<extensions>true</extensions>
|
<extensions>true</extensions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<serverId>ossrh</serverId> <!-- 与settings.xml中的server id对应 -->
|
<publishingServerId>central</publishingServerId>
|
||||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
<!-- 确保所有文件都被签名 -->
|
||||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
<autoPublish>true</autoPublish>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- Maven Release Plugin - 用于版本发布 -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-release-plugin</artifactId>
|
|
||||||
<version>3.0.1</version>
|
|
||||||
<configuration>
|
|
||||||
<tagNameFormat>v@{project.version}</tagNameFormat>
|
|
||||||
<autoVersionSubmodules>true</autoVersionSubmodules>
|
|
||||||
<useReleaseProfile>false</useReleaseProfile>
|
|
||||||
<releaseProfiles>release</releaseProfiles>
|
|
||||||
<goals>deploy</goals>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!-- Maven Shade Plugin - 另一个可选的打包插件,可以与Assembly Plugin二选一 -->
|
|
||||||
<!-- 如果您想使用Shade Plugin而不是Assembly Plugin,可以取消下面的注释 -->
|
|
||||||
<!--
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>3.5.0</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
|
||||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
|
||||||
<shadedClassifierName>with-dependencies</shadedClassifierName>
|
|
||||||
<transformers>
|
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
|
||||||
<mainClass>com.yourcompany.MainClass</mainClass>
|
|
||||||
</transformer>
|
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
|
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
|
||||||
<resource>META-INF/spring.handlers</resource>
|
|
||||||
</transformer>
|
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
|
||||||
<resource>META-INF/spring.schemas</resource>
|
|
||||||
</transformer>
|
|
||||||
</transformers>
|
|
||||||
<filters>
|
|
||||||
<filter>
|
|
||||||
<artifact>*:*</artifact>
|
|
||||||
<excludes>
|
|
||||||
<exclude>META-INF/*.SF</exclude>
|
|
||||||
<exclude>META-INF/*.DSA</exclude>
|
|
||||||
<exclude>META-INF/*.RSA</exclude>
|
|
||||||
</excludes>
|
|
||||||
</filter>
|
|
||||||
</filters>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
-->
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<!-- 发布配置 -->
|
|
||||||
<distributionManagement>
|
|
||||||
<snapshotRepository>
|
|
||||||
<id>ossrh</id>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
|
||||||
</snapshotRepository>
|
|
||||||
<repository>
|
|
||||||
<id>ossrh</id>
|
|
||||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
|
||||||
</repository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
<!-- 发布配置文件 -->
|
<!-- 发布配置文件 -->
|
||||||
<profiles>
|
<profiles>
|
||||||
<profile>
|
<profile>
|
||||||
@@ -301,5 +199,4 @@
|
|||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -347,8 +347,6 @@ public interface HGScannerLib extends HGDef, StdCallLibrary {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取扫描仪库实例
|
* 获取扫描仪库实例
|
||||||
*
|
|
||||||
* @return 扫描仪库实例
|
|
||||||
*/
|
*/
|
||||||
HGScannerLib INSTANCE = Native.load(JNA_LIBRARY_NAME, HGScannerLib.class);
|
HGScannerLib INSTANCE = Native.load(JNA_LIBRARY_NAME, HGScannerLib.class);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user