【问题标题】:Error 405: Method Not Allowed Maven default repository错误 405:不允许使用方法 Maven 默认存储库
【发布时间】:2016-11-26 23:27:23
【问题描述】:

我试图通过使用 mvn deploy 在 maven 上发布我的项目,但我似乎遇到了问题...我没有个人存储库,我想将我的 repo 发布到 maven Central存储库没有多大成功...

错误是:

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project telegram: Failed to deploy artifacts: Could not transfer artifact ...jar... from/to central (https://repo1.maven.org/maven2/): Failed to transfer file: ...jar.... Return code is: 405, ReasonPhrase: Method Not Allowed. 

如果错误的格式不是特别好,我很抱歉,但我希望它足够好。

我的 pom 看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

<groupId>id</groupId>
<artifactId>id</artifactId>
<version>version</version>

<dependencies>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20140107</version>
    </dependency>
</dependencies>

<distributionManagement>
    <repository>
        <id>central</id>
        <name>Central Repository</name>
        <url>https://repo1.maven.org/maven2/</url>
        <layout>default</layout>
    </repository>
</distributionManagement>

<pluginRepositories>
    <pluginRepository>
        <id>central</id>
        <name>Central Repository</name>
        <url>https://repo1.maven.org/maven2/</url>
        <layout>default</layout>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <updatePolicy>never</updatePolicy>
        </releases>
    </pluginRepository>
</pluginRepositories>

【问题讨论】:

  • 为什么要在 pom 文件中重新定义 Maven 的默认值?如果您想分发到 Maven Central,请在此处阅读:central.sonatype.org
  • @khmarbaise 我不太了解 maven...我如何使用那个 repo?
  • 你可以使用默认已经定义好的repos。仅当您定义了一个存储库管理器时,distributionManagement 才有意义,您可以在其中部署自己的结果maven.apache.org/repository-management.html

标签: java eclipse maven maven-3


【解决方案1】:

这可能不是您遇到的问题,但我注意到在维护窗口期间也可能出现无用的 405 Not Allowed 错误消息。在浏览器中访问暂存部署 URL 时:https://oss.sonatype.org/service/local/staging/deploy/maven2,

然后出现更有用的错误信息:

维护期间不允许使用该方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-20
    • 2017-11-13
    • 2016-12-02
    • 2012-10-25
    • 2012-03-21
    • 2015-11-25
    • 1970-01-01
    • 2012-08-24
    相关资源
    最近更新 更多