使用 mvn clean deploy 发布 maven 库时发生错误
场景
配置了 gpg 密钥并上传到了 公钥服务器,sonatype 也审核通过了,但在打包时仍然发生了以下错误
[INFO] --- maven-gpg-plugin:1.6:sign (default) @ rx-easy-excel ---
gpg: cannot open tty `no tty': No such file or directory
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.177 s
[INFO] Finished at: 2019-04-12T09:05:09+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign (default) on project rx-easy-excel: Exit code: 2 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
具体的 settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!--
设置系统本地仓库的路径
默认为 ~/.m2/repository
-->
<localRepository>${user.home}/.m2/repository</localRepository>
<!--
maven 是否需要与用户交互(即用户输入命令)
默认为 true
-->
<interactiveMode>true</interactiveMode>
<!--
表示 maven 是否需要在离线模式下运行
默认为 false
-->
<offline>false</offline>
<!--
当插件的组织 id(groupId)没有显式提供时,供搜寻插件组织 Id(groupId)的列表
-->
<pluginGroups>
</pluginGroups>
<!--
代理列表
-->
<proxies>
<proxy>
<id>local-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>127.0.0.1</host>
<port>1080</port>
</proxy>
</proxies>
<!--
一般,仓库的下载和部署是在 pom.xml 文件中的repositories和distributionManagement元素中定义的。然而,一般类似用户名、密码(有些仓库访问是需要安全认证的)等信息不应该在 pom.xml 文件中配置,这些信息可以配置在settings.xml中。
-->
<!--
根据环境参数来调整构建配置的列表
-->
<profiles>
<profile>
<id>JDK-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<!--配置一些属性-->
<properties>
<file.encoding>UTF-8</file.encoding>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
</profile>
<profile>
<id>rx-easy-excel</id> <!-- give it the name of your project -->
<properties>
<gpg.homedir>${user.home}/.gnupg</gpg.homedir>
<gpg.keyname>C1945258</gpg.keyname>
<gpg.passphrase>passphrase</gpg.passphrase>
</properties>
</profile>
</profiles>
<servers>
<server>
<id>ossrh</id>
<username>username</username>
<password>password</password>
</server>
</servers>
</settings>
项目的 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.rxliuli</groupId>
<artifactId>rx-easy-excel</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>rx-easy-excel</name>
<url>https://github.com/rxliuli/rx-easy-excel</url>
<description>fork 自 https://github.com/mrdear/easy-excel,修改代码以复合项目需求,此仓库仅用于修改后快速发布版本。</description>
<developers>
<developer>
<id>rxliuli</id>
<name>rxliuli</name>
<email>rxliuli@gmail.com</email>
<roles>
<role>Developer</role>
</roles>
<timezone>+8</timezone>
</developer>
</developers>
<licenses>
<license>
<name>MIT</name>
<url>https://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://github.com/rxliuli/rx-easy-excel</url>
<connection>https://github.com/rxliuli/rx-easy-excel.git</connection>
</scm>
<properties>
<poi.version>3.17</poi.version>
<commons-lang3.version>3.6</commons-lang3.version>
<slf4j-api.version>1.7.25</slf4j-api.version>
<javax.servlet-api.version>3.1.0</javax.servlet-api.version>
<logback-core.version>1.2.3</logback-core.version>
<lombok.version>1.16.18</lombok.version>
<rx-easy-test-spring-boot-starter.version>0.0.3</rx-easy-test-spring-boot-starter.version>
<!--禁用 doclint 检测-->
<additionalparam>-Xdoclint:none</additionalparam>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax.servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.rxliuli</groupId>
<artifactId>rx-easy-test-spring-boot-starter</artifactId>
<version>${rx-easy-test-spring-boot-starter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>rx-easy-test-spring-boot-starter</id>
<url>
https://raw.githubusercontent.com/rxliuli/rx-easy-test-spring-boot-starter/mvn-repo/
</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.8</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.11.1</version>
</dependency>
<dependency>
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<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>
<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>
<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>
有人遇到过这个问题么?
我也遇到了这个问题 你解决了么 mac os