背景:在清理资源的时候,发现了一个比较好的开源库,但是是在2014年作者写的,比较老,而且好多我想要的功能都没有,所以就想fork出来一个新的工程,更改一下,发布一个新的供大家使用。所以就有了接下来的填坑的过程,耗时一天的时间,终于成功了,
适用:该篇文章适合maven小白发布,现在回头看看,昨天的自己好无知。
大体思想是按照下面这篇文章的思路,但是中间碰到了很多坑,所以在此记录下来。
https://yq.aliyun.com/articles/26352
第一步:到网站注册:
这个没有什么难的:参考:https://issues.sonatype.org/browse/OSSRH-26315
主要注意流程,先注册,按照要求填写内容,如果不符合,会有管理者写comment提示的,合格之后,会comment下面内容
com.github.xiepengchong has been prepared, now user(s) xiepengchong can:
- Deploy snapshot artifacts into repository https://oss.sonatype.org/content/repositories/snapshots
- Deploy release artifacts into the staging repository https://oss.sonatype.org/service/local/staging/deploy/maven2
- Promote staged artifacts into repository 'Releases'
- Download snapshot and release artifacts from group https://oss.sonatype.org/content/groups/public
- Download snapshot, release and staged artifacts from staging group https://oss.sonatype.org/content/groups/staging
please comment on this ticket when you promoted your first release, thanks
第二部:安装GPG,并且生成签名,这个过程教程很多也没有坑,就不详细介绍了。
有一个就是将公钥发送给服务器的时候,有时经常会报timeout,需要多试几次,一般不需要*就可以成功。
看自己上传成功与否,只需要在“查找公钥”中查找自己的公钥。如果成功的话是能够查找的,如果查不到,就是没成功
第三部:就是发布的过程了,(这里先把所有的坑都记录一下)
wudideMacBook-Pro:1.0.1 xiepengchong$ /Users/xiepengchong/Downloads/apache-maven-3.3.9/bin/mvn clean deploy
报错:The goal you specified requires a project to execute but there is no POM in this directory (/Users/xiepengchong/.m2/repository/com/github/xiepengchong/lint-cleaner-plugin/1.0.1). Please verify you invoked Maven from the correct directory.原因:我的工程下并没有写pom.xml(一开始有个lint-cleaner-plugin-1.0.1.pom,结果不行,这里名字必须统一)
由于lint-cleaner-plugin-1.0.1.pom是我在./gradlew install时自动生成的,所以我以为改个名字就ok了,(事实证明两者差距并不大)
再次执行的时候,这个错误确实没有了,但遇到了另一个错误
报错:
[INFO] Installing /Users/xiepengchong/.m2/repository/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/pom.xml to /Users/xiepengchong/.m2/repository/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ lint-cleaner-plugin ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:32 min
[INFO] Finished at: 2016-11-18T11:47:20+08:00
[INFO] Final Memory: 13M/143M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project lint-cleaner-plugin: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [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
原因:这个很明显是url没有制定,所以我们增加下面的内容:url前面管理员告诉我们的。
66 <distributionManagement>
67 <repository>
68 <id>releases</id>
69 <name>Nexus Release Repository</name>
70 <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
71 </repository>
72 <snapshotRepository>
73 <id>snapshots</id>
74 <name>Nexus Snapshot Repository</name>
75 <url>https://oss.sonatype.org/content/repositories/snapshots</url>
76 </snapshotRepository>
77 </distributionManagement>
这个错误消失了,但又遇到了其他的问题
错误:
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'https' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/xiepengchong/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [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/NoPluginFoundForPrefixException
原因:这个是插件版本有问题。(打开pom.xml更改版本号)
之前的版本是 org.codehaus.groovy:groovy-all:2.2.+
改成了 org.codehaus.groovy:groovy-all:2.4.4
下一个错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project lint-cleaner-plugin: Failed to deploy artifacts: Could not transfer artifact com.github.xiepengchong:lint-cleaner-plugin:jar:1.0.1 from/to releases (https://oss.sonatype.org/service/local/staging/deploy/maven2): Failed to transfer file: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [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
原因:这个也很容易看出来是认证的问题,思考一下,就会发现应该是我们的nexus的用户名和密码错误了(按照上面的网址中的key是不错的),
所以到(如果没有自己建一个)
/Users/xiepengchong/.m2/settings.xml
1 <settings>
2 <servers>
3 <server>
4 <id>snapshots</id>
5 <username>nexus_name</username>
6 <password>nexus_password</password>
7 </server>
8 <server>
9 <id>releases</id>
10 <username>nexus_name</username>
11 <password>nexus_password</password>
12 </server>
13 </servers>
14 </settings>
其实到这里,我再次执行mvn clean deploy就已经成功了,
[INFO] Building jar: /Users/xiepengchong/.m2/repository/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/target/lint-cleaner-plugin-1.0.1.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ lint-cleaner-plugin ---
[INFO] Installing /Users/xiepengchong/.m2/repository/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/target/lint-cleaner-plugin-1.0.1.jar to /Users/xiepengchong/.m2/repository/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.jar
[INFO] Installing /Users/xiepengchong/.m2/repository/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/pom.xml to /Users/xiepengchong/.m2/repository/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ lint-cleaner-plugin ---
Uploading: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.jar
Uploaded: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.jar (3 KB at 0.2 KB/sec)
Uploading: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.pom
Uploaded: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.pom (2 KB at 2.1 KB/sec)
Downloading: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/maven-metadata.xml
Uploading: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/maven-metadata.xml
Uploaded: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/maven-metadata.xml (322 B at 0.3 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.001 s
[INFO] Finished at: 2016-11-18T13:31:37+08:00
[INFO] Final Memory: 16M/298M
[INFO] ------------------------------------------------------------------------
看到这个其实已经是成功了,只是我还傻傻的不知道。后面的内容仅作为纪录,在这里,我们就已经成功了,然后到https://oss.sonatype.org/#view-repositories(右边列表会有我们上传的纪录->close -> release 然后到网站上加个comment就完成了,接下来就等着审批吧)
在这里如果在close的时候提示签名不对,failed了,就说明我们GPG签名没有配置,由于release版本是必须要签名的,
所以需要在pom.xml中配置自动签名,
49 <build>
50 <plugins>
51 <plugin>
52 <groupId>org.apache.maven.plugins</groupId>
53 <artifactId>maven-gpg-plugin</artifactId>
54 <version>1.5</version>
55 <executions>
56 <execution>
57 <phase>verify</phase>
58 <goals>
59 <goal>sign</goal>
60 </goals>
61 </execution>
62 </executions>
63 </plugin>
64 </plugins>
65 </build>
如果签名成功的最后上传信息是这样的(如果没有asc则证明你应该是没有签名的)
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ lint-cleaner-plugin ---
Uploading: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.jar
Uploaded: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.jar (3 KB at 0.3 KB/sec)
Uploading: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.pom
Uploaded: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.pom (3 KB at 2.1 KB/sec)
Downloading: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/maven-metadata.xml
Uploading: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/maven-metadata.xml
Uploaded: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/maven-metadata.xml (322 B at 0.1 KB/sec)
Uploading: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.jar.asc
Uploaded: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.jar.asc (801 B at 2.2 KB/sec)
Uploading: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.pom.asc
Uploaded: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/xiepengchong/lint-cleaner-plugin/1.0.1/lint-cleaner-plugin-1.0.1.pom.asc (801 B at 2.2 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:07 min
[INFO] Finished at: 2016-11-19T21:19:35+08:00
[INFO] Final Memory: 16M/216M
[INFO] ------------------------------------------------------------------------
==========================================================
下面作为上传snapshot版本的记录,虽然浪费了很多时间,但是还是学到了很多东东。
由于在学习的网址上说:要发布release版本结果我误会了,
wudideMacBook-Pro:1.0.1 xiepengchong$ mvn release:clean release:prepare release:perform
错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project lint-cleaner-plugin: You don't have a SNAPSHOT project in the reactor projects list. -> [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/MojoFailureException
原因:其实我们这个命令是发布snapshot版本,这里,我们需要把pom.xml中的版本后面加上-SNAPSHOT
错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project lint-cleaner-plugin: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare failed: The scm url does not contain a valid delimiter. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project lint-cleaner-plugin: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare failed: The scm url does not contain a valid delimiter.
原因:我的pom.xml中的scm中的url改的时候改错了(包含了不能有的操作符,这个错误可以忽略)
正确的是下面这样的:
29 <scm>
30 <connection>scm:git:git@github.com:xiepengchong/lint-cleaner-plugin.git</connection>
31 <developerConnection>scm:git:git@github.com:xiepengchong/lint-cleaner-plugin.git</developerConnection>
32 <url>https://github.com/xiepengchong/lint-cleaner-plugin</url>
33 <tag>lint-cleaner-plugin-1.0.1</tag>
34 </scm>
错误:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project lint-cleaner-plugin: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-add command failed.
[ERROR] Command output:
[ERROR] fatal: Not a git repository (or any of the parent directories): .git
[ERROR] -> [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/MojoFailureException
原因:这个错误是因为我没有在git工程中操作,直接在git工程中操作就解决了,
错误:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project lint-cleaner-plugin: Unable to tag SCM
[ERROR] Provider message:
[ERROR] The git-tag command failed.
[ERROR] Command output:
[ERROR] fatal: Failed to resolve 'HEAD' as a valid ref.
[ERROR] -> [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/MojoFailureException
原因:这个和上面的是同一个原因,因为我自作聪明的git init了一下,但实际上是没有对应远程仓库的,
错误:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project lint-cleaner-plugin: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-add command failed.
[ERROR] Command output:
[ERROR] The following paths are ignored by one of your .gitignore files:
[ERROR] build/libs/pom.xml
[ERROR] Use -f if you really want to add them.
[ERROR] -> [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/MojoFailureException
原因:我是在生成的jar包文件夹操作的,由于build文件夹的东西,都是git忽略的,所以在添加pom.xml的时候,不可以,所以pom.xml要放到项目的根部录下。
这里我自作聪明的把build从.gitignore中去掉了,但是这种方法是错误的。
错误:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project lint-cleaner-plugin: Unable to tag SCM
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] ssh: Could not resolve hostname github.com:xiepengchong: nodename nor servname provided, or not known
[ERROR] fatal: Could not read from remote repository.
[ERROR]
[ERROR] Please make sure you have the correct access rights
[ERROR] and the repository exists.
原因:我的pom.xml中的scm中的url错了(因为pom.xml是在maven install时自动生成改名的,所以那个网址是不对的)
错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project lint-cleaner-plugin: Unable to tag SCM
[ERROR] Provider message:
[ERROR] The git-tag command failed.
[ERROR] Command output:
[ERROR] fatal: tag 'lint-cleaner-plugin-1.0.1' already exists
[ERROR] -> [Help 1]
原因:上一次操作,建立了tag,但是由于错误了,后续没做,所以需要把tag先干掉,git tag -d lint-cleaner-plugin-1.0.1错误: [INFO] [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/Users/xiepengchong/opensource/2_my-cleaner-plugin/lint-cleaner-plugin/target/checkout). Please verify you invoked Maven from the correct directory. -> [Help 1]
[INFO] [ERROR]
[INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR]
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
原因:我的pom.xml是在本地的,没有上传到git服务器上,所以会有这个错误,
错误: [WARNING] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] [INFO] Scanning for projects...
[INFO] [WARNING]
[INFO] [WARNING] Some problems were encountered while building the effective model for com.github.xiepengchong:lint-cleaner-plugin:jar:1.0.1-SNAPSHOT
[INFO] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing.
[INFO] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing.
[INFO] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-deploy-plugin is missing.
[INFO] [WARNING]
[INFO] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[INFO] [WARNING]
[INFO] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[INFO] [WARNING]
[INFO] [INFO]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Building Lint Cleaner Plugin 1.0.1-SNAPSHOT
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-source-plugin/maven-metadata.xml
[INFO]
[INFO] [WARNING] Could not transfer metadata org.apache.maven.plugins:maven-source-plugin/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: unknown error
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 21.013 s
[INFO] [INFO] Finished at: 2016-11-19T19:20:17+08:00
[INFO] [INFO] Final Memory: 10M/309M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] Error resolving version for plugin 'org.apache.maven.plugins:maven-source-plugin' from the repositories [local (/Users/xiepengchong/.m2/repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository -> [Help 1]
[INFO] [ERROR]
[INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR]
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginVersionResolutionException
原因:这个是因为我并没有在本地制定插件的版本:(如果没有的话,在pom中加入下面内容) 35 <dependencies>
36 <dependency>
37 <groupId>org.codehaus.groovy</groupId>
38 <artifactId>groovy-all</artifactId>
39 <version>2.4.4</version>
40 <scope>compile</scope>
41 </dependency>
42 <dependency>
43 <groupId>org.apache.maven.plugins</groupId>
44 <artifactId>maven-compiler-plugin</artifactId>
45 <version>3.0</version>
46 <type>maven-plugin</type>
47 </dependency>
48 </dependencies>
错误:
1.
[INFO] [ERROR] Error resolving version for plugin 'org.apache.maven.plugins:maven-source-plugin' from the repositories [local (/Users/xiepengchong/.m2/repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository -> [Help 1]
[INFO] [ERROR]
[INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR]
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginVersionResolutionException
2.
[INFO] [ERROR] Failed to execute goal on project lint-cleaner-plugin: Could not resolve dependencies for project com.github.xiepengchong:lint-cleaner-plugin:jar:1.0.1: Failed to collect dependencies at org.apache.maven.plugins:maven-compiler-plugin:jar:2.6: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.6: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.6 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: unknown error: Unknown host repo.maven.apache.org: unknown error -> [Help 1]
[INFO] [ERROR]
[INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR]
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
原因:上面两个错误同一批错误,就是第一次版本配置的不对,这个需要查一下,自己需要那个版本。
下面上传snapshot版本也成功了
[INFO]
[INFO] Uploading: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/1.0.1-SNAPSHOT/lint-cleaner-plugin-1.0.1-20161119.120746-1.jar
[INFO] 2/3 KB
[INFO] 3/3 KB
[INFO]
[INFO] Uploaded: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/1.0.1-SNAPSHOT/lint-cleaner-plugin-1.0.1-20161119.120746-1.jar (3 KB at 1.2 KB/sec)
[INFO] Uploading: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/1.0.1-SNAPSHOT/lint-cleaner-plugin-1.0.1-20161119.120746-1.pom
[INFO] 2/3 KB
[INFO] 3/3 KB
[INFO]
[INFO] Uploaded: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/1.0.1-SNAPSHOT/lint-cleaner-plugin-1.0.1-20161119.120746-1.pom (3 KB at 1.8 KB/sec)
[INFO] Downloading: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/maven-metadata.xml
[INFO]
[INFO] Uploading: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/1.0.1-SNAPSHOT/maven-metadata.xml
[INFO] 792/792 B
[INFO]
[INFO] Uploaded: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/1.0.1-SNAPSHOT/maven-metadata.xml (792 B at 0.2 KB/sec)
[INFO] Uploading: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/maven-metadata.xml
[INFO] 302/302 B
[INFO]
[INFO] Uploaded: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/maven-metadata.xml (302 B at 0.2 KB/sec)
[INFO] Uploading: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/1.0.1-SNAPSHOT/lint-cleaner-plugin-1.0.1-20161119.120746-1-sources.jar
[INFO] 2/3 KB
[INFO] 3/3 KB
[INFO]
[INFO] Uploaded: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/1.0.1-SNAPSHOT/lint-cleaner-plugin-1.0.1-20161119.120746-1-sources.jar (3 KB at 2.2 KB/sec)
[INFO] Uploading: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/1.0.1-SNAPSHOT/maven-metadata.xml
[INFO] 1006/1006 B
[INFO]
[INFO] Uploaded: https://oss.sonatype.org/content/repositories/snapshots/com/github/xiepengchong/lint-cleaner-plugin/1.0.1-SNAPSHOT/maven-metadata.xml (1006 B at 0.2 KB/sec)
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 03:25 min
[INFO] [INFO] Finished at: 2016-11-19T20:08:02+08:00
[INFO] [INFO] Final Memory: 21M/221M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] Cleaning up after release...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:01 min
[INFO] Finished at: 2016-11-19T20:08:02+08:00
[INFO] Final Memory: 13M/309M
[INFO] ------------------------------------------------------------------------
踏踏实实的解决每一个问题,最终都是帮助你成长的阶梯。