Maven部署,另一个未经授权的401

时间:2015-10-17 16:28:09

标签: java maven jcenter

这让我疯了......我读了,重读了已经完成的关于这个主题的帖子,以一种方式破坏了我的pom文件,但没有任何改变....我可以'部署到jcenter ....

我从一个非常简单的pom文件(由mvn创建)开始,现在它更复杂,但仍然......没有上传.... 我现在整合了这里所说的评论,但仍然......

BTW我已经设置了一个包含用户名和API密钥的settings.xml文件.... 就像在bintray网站上展示一样...... 整个来源可在https://github.com/nohkumado/ipx800Control.git

下的github上找到

这是实际的pom文件:

<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
 <groupId>nohkumado</groupId>
 <artifactId>ipx800control</artifactId>
 <packaging>jar</packaging>
 <version>0.1.6</version>
 <name>IPX 800 support library</name>
 <url>https://github.com/nohkumado/ipx800Control</url>
 <inceptionYear>2015</inceptionYear> 
 <organization>
  <name>Noh Kuma Do</name>
 </organization>

 <description>ipx800control is a class that interfaces over local net with an Ipx800v3 domotic controller.</description>

<licenses>
 <license>
    <name>General Public License (GPL) version 3.0</name>
    <url>https://www.gnu.org/licenses/gpl-3.0.txt</url>
 </license>
</licenses>

<developers>
  <developer>
     <name>Nohkumado</name>
     <email>nokumado@gmail.com</email>
     <roles>
        <role>Lead Developer</role>
     </roles>
  </developer>
</developers>

<dependencies>
 <dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>3.8.1</version>
  <scope>test</scope>
  </dependency>
  <dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpclient</artifactId>
  <version>4.0-alpha4</version>
  </dependency>
  </dependencies>

  <issueManagement>
   <system>GitHub Issue Tracker</system>
    <url>https://github.com/nohkumado/ipx800Control/issues</url>
  </issueManagement>

  <distributionManagement>
   <repository>
     <id>ipx800Control</id>
         <url>https://api.bintray.com/content/nokumado/maven/ipx800Control;publish=1</url>
     </repository>
    <snapshotRepository>
      <id>ipx800Control</id>
     <url>https://api.bintray.com/content/nokumado/maven/ipx800Control;publish=1</url>
     <!--url>https://api.bintray.com/content/nokumado/maven/ipx800Control/snapshots;publish=1</url-->
   </snapshotRepository>
  </distributionManagement>

 <scm>
   <connection>
       scm:git:git@github.com:nohkumado/ipx800Control.git
    </connection>
     <url>scm:git:git@github.com:nohkumado/ipx800Control.git</url>
      <developerConnection>
        scm:git:git@github.com:nohkumado/ipx800Control.git
      </developerConnection>
    <tag>HEAD</tag>
</scm>


<build>
 <plugins>
   <plugin>
   <artifactId>maven-release-plugin</artifactId>
    <version>2.4.1</version>
   <configuration>
    <useReleaseProfile>false</useReleaseProfile>
    <releaseProfiles>release</releaseProfiles>
   <autoVersionSubmodules>true</autoVersionSubmodules>
 </configuration>
  </plugin>
 </plugins>
</build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
    <plugins>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
        <id>attach-sources</id>
        <goals>
          <goal>jar</goal>
        </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
          <id>attach-javadocs</id>
          <goals>
        <goal>jar</goal>
          </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
      </build>
    </profile>
  </profiles>

</project>

以下是mvn部署日志的日志:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building IPX 800 support library 0.1.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ ipx800control ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/devel/java/ipx800Control/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ ipx800control ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) @ ipx800control ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/devel/java/ipx800Control/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ ipx800control ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ ipx800control ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ ipx800control ---
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ ipx800control ---
[INFO] Installing /home/devel/java/ipx800Control/target/ipx800control-0.1.3-SNAPSHOT.jar to /home/devel/.m2/repository/nohkumado/ipx800control/0.1.3-SNAPSHOT/ipx800control-0.1.3-SNAPSHOT.jar
[INFO] Installing /home/devel/java/ipx800Control/pom.xml to /home/devel/.m2/repository/nohkumado/ipx800control/0.1.3-SNAPSHOT/ipx800control-0.1.3-SNAPSHOT.pom
[INFO] 
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @    ipx800control ---
   Downloading:    https://api.bintray.com/content/nokumado/maven/ipx800Control;publish=1/nohkumado/ipx800control/0.1.3-SNAPSHOT/maven-metadata.xml

Uploading:      https://api.bintray.com/content/nokumado/maven/ipx800Control;publish=1/nohkumado/ipx800control/0.1.3-SNAPSHOT/ipx800control-0.1.3-20151022.200837-1.jar
   2/8 KB   
  4/8 KB   
  6/8 KB   
  8/8 KB   

 Uploading:  https://api.bintray.com/content/nokumado/maven/ipx800Control;publish=1/nohkumado/ipx800control/0.1.3-SNAPSHOT/ipx800control-0.1.3-20151022.200837-1.pom
  2/4 KB   
  4/4 KB   

 [INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.757 s
[INFO] Finished at: 2015-10-22T22:08:39+02:00
[INFO] Final Memory: 16M/217M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project ipx800control: Failed to deploy artifacts: Could not transfer artifact nohkumado:ipx800control:jar:0.1.3-20151022.200837-1 from/to ipx800Control (https://api.bintray.com/content/nokumado/maven/ipx800Control;publish=1): Failed to transfer file: https://api.bintray.com/content/nokumado/maven/ipx800Control;publish=1/nohkumado/ipx800control/0.1.3-SNAPSHOT/ipx800control-0.1.3-20151022.200837-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

〜/ .m2 / repository的内容(看起来对我有用......)

insgesamt 96
-rw-r--r-- 1 devel devel  8155 Okt 21 10:06 ipx800control-0.1.3-SNAPSHOT.jar
-rw-r--r-- 1 devel devel 53875 Okt 18 01:52 ipx800control-0.1.3-SNAPSHOT-javadoc.jar
-rw-r--r-- 1 devel devel  3311 Okt 18 01:37 ipx800control-0.1.3-SNAPSHOT.pom
-rw-r--r-- 1 devel devel  8594 Okt 18 01:52 ipx800control-0.1.3-SNAPSHOT-sources.jar
-rw-r--r-- 1 devel devel   772 Okt 22 22:08 maven-metadata-ipx800Control.xml
-rw-r--r-- 1 devel devel  1118 Okt 22 22:08 maven-metadata-local.xml
-rw-r--r-- 1 devel devel   290 Okt 22 22:08 _remote.repositories
-rw-r--r-- 1 devel devel   193 Okt 22 22:08 resolver-status.properties

所以我仍然被困......并且仍然在我的智慧结束这里出了什么问题.... 我试图手动上传一个jar到网站(v0.0.2),这有效... 顺便说一句,当我从0.0.version切换到0.version时,它看起来效果更好......

所以任何帮助都非常感谢!

2 个答案:

答案 0 :(得分:0)

Bintray是一个分发平台,不适用于SNAPSHOT版本。您不能将SNAPSHOT-s部署到Bintray。

如果您需要一个存储库来处理SNAPSHOT,Artifact Repository如Artifactory将是更好的选择。您甚至可以将它for free用于Maven和Gradle项目,或使用免费的oss.jfrog.org instance of Artifactory in the cloud, as long as you are publishing OSS projects to Bintray's JCenter

答案 1 :(得分:-1)

首先,正如@JBaruch所指出的,Bintray只处理发布,所以甚至不打扰上传快照。

我可以通过Maven向Bintray做好发布。

POM中的<distributionManagement>看起来像这样:

<distributionManagement>
    <repository>
      <id>bintray</id>
      <name>Bintray</name>
      <!-- publish=1 or 0 doesn't really matter, you can publish 
           through Bintray UI later if you set publish=0 -->
      <url>https://api.bintray.com/maven/<my username>/maven/<my Bintray package>/;publish=0</url>
    </repository>
</distributionManagement>

在我的settings.xml中,我的凭据被指定为:

<server>
  <id>bintray</id>
  <username><my username></username>
  <password><my api key></password> <!-- NOT my Bintray password -->
</server>

这假设您已在Bintray上的Maven存储库下创建了一个Bintray包。

除了<repository>部分之外,我没有定义任何settings.xml标记(在POM和<distributionManagement>中都没有),因为它必须在那里。