上传自己的jar包到maven中央仓库

2020-11-30  本文已影响0人  武小寺

申请账号

新建项目(github or gitee)

申请权限

加密验签

配置maven与项目的pom文件

maven setting.xml

<server>
    <id>oss</id>
    <username>kx</username>
    <password>oRVJqmU30Rbc%</password>
</server>
pom文件

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.gitee.xxx</groupId>
    <artifactId>xx-tools</artifactId>
    <version>1.0</version>
    <name>xx-tools</name>
    <description>Spring Boot tools for phone,ip</description>
    <url>https://gitee.com/xxx/xx-tools</url>
    <!-- 开源签名证书 -->
    <licenses>
        <license>
            <name>The MIT License</name>
            <url>http://opensource.org/licenses/MIT</url>
        </license>
    </licenses>
    <!-- 开发人员信息 -->
    <developers>
        <developer>
            <name>xxxx</name>
            <email>xxxx@163.com</email>
        </developer>
    </developers>

    <!-- 仓库信息 -->
    <scm>
        <connection>scm:git:git://gitee.com:xxxx/xx-tools.git</connection>
        <developerConnection>scm:git:git://gitee.com:xxxx/xx-tools.git</developerConnection>
        <url>https://gitee.com/xxxx/xx-tools</url>
    </scm>


    <dependencies>


    </dependencies>
    <build>
        <plugins>
            <!-- Source -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- GPG -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <distributionManagement>
        <snapshotRepository>
            <id>oss</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>oss</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

</project>

打包上传成功

错误处理

gpg signing failed inappropriate ioctl for device Mac

$ brew install pinentry-mac
$ echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
$ killall gpg-agent
上一篇 下一篇

猜你喜欢

热点阅读