本地打包
mvn install:install-file -Dfile=D:\program\lib\ojdbc7.jar -DgroupId=com.github.glory2018 -DartifactId=ojdbc7 -Dversion=12.1.0.2.0 -Dpackaging=jar
添加本地jar
<!--添加本地的jacob.jar包-->
<dependency>
<groupId>com.jacob</groupId>
<artifactId>jacob</artifactId>
<version>1.19</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/resources/lib/jacob.jar</systemPath>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/resources/lib/ojdbc7.jar</systemPath>
</dependency>
jar发布到中央仓库
注册
https://issues.sonatype.org/secure/Dashboard.jspa
新建
GPG 生成密钥对
下载Gpg4win
https://www.gpg4win.org/download.html
新建密匙对
修改全局的setting.xml
<server>
<id>ossrh</id>
<username>repouser</username>
<password>repopwd</password>
</server>
pom.xml修改
<?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.github.glory2018</groupId>
<artifactId>nexus-oss</artifactId>
<version>1</version>
<name>nexus-oss</name>
<description>nexus-oss</description>
<url>https://github.com/glory2018/nexus-oss</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>actable</distribution>
</license>
</licenses>
<developers>
<developer>
<name>steve2019frank</name>
<email>bjfansr@cn.ibm.com</email>
<organization>ibm</organization>
<url>https://github.com/glory2018/nexus-oss</url>
</developer>
</developers>
<scm>
<connection>https://github.com/glory2018/nexus-oss.git</connection>
<developerConnection>https://github.com/glory2018</developerConnection>
<url>https://github.com/glory2018/nexus-oss.git</url>
<tag>1.0</tag>
</scm>
<dependencies>
<!--添加本地的jacob.jar包-->
<dependency>
<groupId>com.jacob</groupId>
<artifactId>jacob</artifactId>
<version>1.19</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/resources/lib/jacob.jar</systemPath>
</dependency>
</dependencies>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<!-- Source -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.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.9.1</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.6</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</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>
</profile>
</profiles>
</project>
上传构件到 OSS 中
mvn clean deploy -P release
在OSS 系统中发布构件
在 Staging Repositories 中查看刚才已上传的构件,状态为 Open,需要勾选它,然后点击 Close 按钮
如果提示Event: Failed: Signature Validation
gpg --keyserver hkp://pool.sks-keyservers.net --send-keys A133E51E7AAD0D32A46E2BE28FFFE02963AB0DCD
重新Close
点击 Release 按钮来发布该构件
从中央仓库中搜索构件
以后的发布流程:
构件完成后直接使用maven在命令行上传构建;