问题描述
我正在尝试将项目部署到Maven进行Bintray,该项目已成功上传pom文件,但是在上传jar文件时返回错误代码401。
我已经阅读了Bintray教程,正确设置了settings.xml,将正确的distributionManagement等字段添加到了pom文件中,确保该项目不是快照等,但是似乎无法上传jar文件。加工?我一直在尝试找出可能发生的情况,但没有成功。
有关堆栈跟踪pom.xml,settings.xml和eclipse配置的详细信息在下面。整个项目可以在github
上找到我在这里缺少明显的东西吗?任何帮助表示赞赏。
[DEBUG] (f) packaging = jar
[DEBUG] (f) pomFile = /Users/au671271/git/pytorch2java/PyTorch2Java/pom.xml
[DEBUG] (s) skip = false
[DEBUG] (f) updateReleaseInfo = false
[DEBUG] -- end configuration --
[INFO] Installing /Users/au671271/git/pytorch2java/PyTorch2Java/target/jtorch4pam-0.0.63.jar to /Users/au671271/.m2/repository/org/jamdev/jtorch4pam/0.0.63/jtorch4pam-0.0.63.jar
[DEBUG] Writing tracking file /Users/au671271/.m2/repository/org/jamdev/jtorch4pam/0.0.63/_remote.repositories
[INFO] Installing /Users/au671271/git/pytorch2java/PyTorch2Java/pom.xml to /Users/au671271/.m2/repository/org/jamdev/jtorch4pam/0.0.63/jtorch4pam-0.0.63.pom
[DEBUG] Writing tracking file /Users/au671271/.m2/repository/org/jamdev/jtorch4pam/0.0.63/_remote.repositories
[DEBUG] Installing org.jamdev:jtorch4pam/maven-metadata.xml to /Users/au671271/.m2/repository/org/jamdev/jtorch4pam/maven-metadata-local.xml
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ jtorch4pam ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=75304,ConflictMarker.markTime=31640,ConflictMarker.nodeCount=32,ConflictIdSorter.graphTime=78145,ConflictIdSorter.topsortTime=17029,ConflictIdSorter.conflictIdCount=14,ConflictIdSorter.conflictIdCycleCount=0,ConflictResolver.totalTime=349870,ConflictResolver.conflictItemCount=32,DefaultDependencyCollector.collectTime=7611621,DefaultDependencyCollector.transformTime=581161}
[DEBUG] org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-project:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-settings:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-profile:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG] junit:junit:jar:3.8.1:compile
[DEBUG] classworlds:classworlds:jar:1.1-alpha-2:compile
[DEBUG] org.apache.maven:maven-model:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-artifact:jar:2.0.6:compile
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.5.6:compile
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7
[DEBUG] Included: org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
[DEBUG] Included: junit:junit:jar:3.8.1
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:1.5.6
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7,parent: jdk.internal.loader.ClassLoaders$AppClassLoader@55054057]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy' with basic configurator -->
[DEBUG] (f) artifact = org.jamdev:jtorch4pam:jar:0.0.63
[DEBUG] (f) attachedArtifacts = []
[DEBUG] (s) localRepository = id: local
url: file:///Users/au671271/.m2/repository/
layout: default
snapshots: [enabled => true,update => always]
releases: [enabled => true,update => always]
[DEBUG] (f) offline = false
[DEBUG] (f) packaging = jar
[DEBUG] (f) pomFile = /Users/au671271/git/pytorch2java/PyTorch2Java/pom.xml
[DEBUG] (f) project = MavenProject: org.jamdev:jtorch4pam:0.0.63 @ /Users/au671271/git/pytorch2java/PyTorch2Java/pom.xml
[DEBUG] (f) retryFailedDeploymentCount = 1
[DEBUG] (f) skip = false
[DEBUG] (f) updateReleaseInfo = false
[DEBUG] -- end configuration --
[DEBUG] Using connector AetherRepositoryConnector with priority 100.0 for https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1 with username=macster110,password=***
[INFO] Uploading to : https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1/org/jamdev/jtorch4pam/0.0.63/jtorch4pam-0.0.63.pom
[INFO] Uploading to : https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1/org/jamdev/jtorch4pam/0.0.63/jtorch4pam-0.0.63.jar
[INFO] Uploaded to : https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1/org/jamdev/jtorch4pam/0.0.63/jtorch4pam-0.0.63.pom (8.7 kB at 2.3 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.879 s
[INFO] Finished at: 2020-09-22T10:56:47+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project jtorch4pam: Failed to deploy artifacts: Could not transfer artifact org.jamdev:jtorch4pam:jar:0.0.63 from/to bintray-macster110-jtorch4pam (https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1): Access denied to https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1/org/jamdev/jtorch4pam/0.0.63/jtorch4pam-0.0.63.jar. Error code 401,Unauthorized -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project jtorch4pam: Failed to deploy artifacts: Could not transfer artifact org.jamdev:jtorch4pam:jar:0.0.63 from/to bintray-macster110-jtorch4pam (https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1): Access denied to https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1/org/jamdev/jtorch4pam/0.0.63/jtorch4pam-0.0.63.jar. Error code 401,Unauthorized
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy artifacts: Could not transfer artifact org.jamdev:jtorch4pam:jar:0.0.63 from/to bintray-macster110-jtorch4pam (https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1): Access denied to https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1/org/jamdev/jtorch4pam/0.0.63/jtorch4pam-0.0.63.jar. Error code 401,Unauthorized
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:193)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
... 20 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts: Could not transfer artifact org.jamdev:jtorch4pam:jar:0.0.63 from/to bintray-macster110-jtorch4pam (https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1): Access denied to https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1/org/jamdev/jtorch4pam/0.0.63/jtorch4pam-0.0.63.jar. Error code 401,Unauthorized
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:146)
at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy(AbstractDeployMojo.java:167)
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:157)
... 22 more
Caused by: org.eclipse.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not transfer artifact org.jamdev:jtorch4pam:jar:0.0.63 from/to bintray-macster110-jtorch4pam (https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1): Access denied to https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1/org/jamdev/jtorch4pam/0.0.63/jtorch4pam-0.0.63.jar. Error code 401,Unauthorized
at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:301)
at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:213)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:386)
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:142)
... 24 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.jamdev:jtorch4pam:jar:0.0.63 from/to bintray-macster110-jtorch4pam (https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1): Access denied to https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1/org/jamdev/jtorch4pam/0.0.63/jtorch4pam-0.0.63.jar. Error code 401,Unauthorized
at io.takari.aether.connector.AetherRepositoryConnector$2.wrap(AetherRepositoryConnector.java:889)
at io.takari.aether.connector.AetherRepositoryConnector$2.wrap(AetherRepositoryConnector.java:1)
at io.takari.aether.connector.AetherRepositoryConnector$PutTask.flush(AetherRepositoryConnector.java:732)
at io.takari.aether.connector.AetherRepositoryConnector.put(AetherRepositoryConnector.java:373)
at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:295)
... 27 more
Caused by: io.takari.aether.connector.AuthorizationException: Access denied to https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1/org/jamdev/jtorch4pam/0.0.63/jtorch4pam-0.0.63.jar. Error code 401,Unauthorized
at io.takari.aether.connector.AetherRepositoryConnector.handleResponseCode(AetherRepositoryConnector.java:397)
at io.takari.aether.connector.AetherRepositoryConnector.access$8(AetherRepositoryConnector.java:391)
at io.takari.aether.connector.AetherRepositoryConnector$PutTask.run(AetherRepositoryConnector.java:703)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
[ERROR]
[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
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>org.jamdev</groupId>
<artifactId>jtorch4pam</artifactId>
<version>0.0.63</version>
<packaging>jar</packaging>
<name>jamdev</name>
<url>https://github.com/macster110/JTorch4PAM</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>spring-repo</id>
<url>https://repo.spring.io/libs-milestone/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.facebook.soloader</groupId>
<artifactId>nativeloader</artifactId>
<version>0.9.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.facebook.fbjni/fbjni-java-only -->
<dependency>
<groupId>com.facebook.fbjni</groupId>
<artifactId>fbjni-java-only</artifactId>
<version>0.0.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.pytorch/pytorch_java_only -->
<dependency>
<groupId>org.pytorch</groupId>
<artifactId>pytorch_java_only</artifactId>
<version>1.6.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jflac/jflac-codec -->
<dependency>
<groupId>org.jflac</groupId>
<artifactId>jflac-codec</artifactId>
<version>1.5.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
<!-- filter library -->
<dependency>
<groupId>uk.me.berndporr</groupId>
<artifactId>iirj</artifactId>
<version>1.1</version>
</dependency>
<!-- MATLAB import and export library -->
<dependency>
<groupId>us.hebi.matlab.mat</groupId>
<artifactId>mfl-core</artifactId>
<version>0.5.6</version>
</dependency>
<!-- Deep Java Library -->
<dependency>
<groupId>ai.djl</groupId>
<artifactId>api</artifactId>
<version>0.7.0</version>
</dependency>
<dependency>
<groupId>ai.djl.pytorch</groupId>
<artifactId>pytorch-model-zoo</artifactId>
<version>0.7.0</version>
</dependency>
<dependency>
<groupId>ai.djl.pytorch</groupId>
<artifactId>pytorch-native-cpu</artifactId>
<classifier>osx-x86_64</classifier>
<version>1.6.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ai.djl.pytorch</groupId>
<artifactId>pytorch-native-auto</artifactId>
<version>1.6.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>14</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
</plugin>
</plugins>
</build>
<licenses>
<license>
<name>GPL-3.0</name>
<url>https://opensource.org/licenses/GPL-3.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://github.com/macster110/JTorch4PAM.git</url>
</scm>
<developers>
<developer>
<id>macster110</id>
<name>Jamie Macaulay</name>
<roles>
<role>Developer</role>
</roles>
</developer>
</developers>
<description>Deep learning tools for passive acoustic monitoring</description>
<distributionManagement>
<repository>
<id>bintray-macster110-jtorch4pam</id>
<name>macster110-jtorch4pam</name>
<url>https://api.bintray.com/maven/macster110/jtorch4pam/dl4pam/;publish=1</url>
</repository>
</distributionManagement>
</project>
settings.xml文件(已删除密码)
<?xml version="1.0" encoding="UTF-8" ?>
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<servers>
<server>
<id>bintray-macster110-jtorch4pam</id>
<username>macster110</username>
<password>88888</password>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>bintray-macster110-jtorch4pam</id>
<name>bintray</name>
<url>https://dl.bintray.com/macster110/jtorch4pam</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>bintray-macster110-jtorch4pam</id>
<name>bintray-plugins</name>
<url>https://dl.bintray.com/macster110/jtorch4pam</url>
</pluginRepository>
</pluginRepositories>
<id>bintray</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>bintray</activeProfile>
</activeProfiles>
</settings>
我在eclipse中用于部署项目的配置。
更新:解决方案
此问题的解决方案是在外部安装maven并使用该安装代替Eclipse随附的嵌入式版本。这样就完全解决了问题。转到“首选项”->“ Maven”->“安装”以添加新的Maven安装,然后确保在运行配置中选择了该版本。
解决方法
尝试使用外部Maven安装。我认为嵌入eclipse(3.6.3版本的Maven)中的maven出现了大文件问题(正确部署了pom.xml)。
我们尝试使用maven 3.5.1、3.6.1和3.6.3进行外部安装并正确部署,但是对于带有嵌入式文件(3.6.3)的大文件(jar或war),给我们一个401错误。相同的配置和用户。
报告了一个与此有关的错误:https://bugs.eclipse.org/bugs/show_bug.cgi?id=566513
报告了更多StackOverflow问题:eclipse maven deploy war to nexus OSS Access denied Error code 401,Unauthorized
编辑:报告了有关该错误的一些新闻。似乎与okhttp组件添加到eclipse中有关,并且该库具有以下错误:
https://github.com/takari/aether-connector-okhttp/issues/29
在解决此错误之前,将提出以下两种解决方法:
- 在“启动配置”中使用外部Maven运行时,而不是嵌入式的(因此不包括以太坊)
- 在启动配置中设置
-Daether.connector.basic.threads=1
。
(您可以在https://bugs.eclipse.org/bugs/show_bug.cgi?id=562847#c7中看到它)
此致
,该错误表示基于HTTP 401代码消息的访问问题:
错误代码401,未经授权
仔细检查您的用户名和密码是否正确。
最好不要将密码输入纯文本,而使用password hash。