gpt4 book ai didi

java - 无法使用 Maven 部署到 Heroku : Forbidden

转载 作者:行者123 更新时间:2023-11-30 03:17:40 25 4
gpt4 key购买 nike

我正在尝试使用 Heroku Maven 插件部署一个依赖于 Heroku 的 jar。我收到此错误消息:

[ERROR] Failed to execute goal com.heroku.sdk:heroku-maven-plugin:0.4.4:deploy (default-cli) on project my-app: Failed to deploy application: Forbidden -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.heroku.sdk:heroku-maven-plugin:0.4.4:deploy (default-cli) on project my-app: Failed to deploy application
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to deploy application
at com.heroku.sdk.maven.DeployMojo.execute(DeployMojo.java:51)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.apache.http.client.HttpResponseException: Forbidden
at com.heroku.sdk.deploy.utils.RestClient.handleResponse(RestClient.java:136)
at com.heroku.sdk.deploy.utils.RestClient.get(RestClient.java:30)
at com.heroku.sdk.deploy.ConfigVars.getConfigVars(ConfigVars.java:41)
at com.heroku.sdk.deploy.ConfigVars.merge(ConfigVars.java:24)
at com.heroku.sdk.deploy.Deployer.mergeConfigVars(Deployer.java:103)
at com.heroku.sdk.deploy.Deployer.deploy(Deployer.java:67)
at com.heroku.sdk.deploy.App.deploy(App.java:57)
at com.heroku.sdk.deploy.App.deploy(App.java:61)
at com.heroku.sdk.maven.DeployMojo.execute(DeployMojo.java:47)
... 21 more

我不知道如何修复。到底什么是禁止的?这是我的 POM:

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>0.4.4</version>
<configuration>
<jdkVersion>1.8</jdkVersion>
<appName>my-app</appName>
<processTypes>
<web>web: java -jar ./target/my-app-1.0-jar-with-dependencies.jar</web>
</processTypes>
</configuration>
</plugin>
</plugins>
</build>

我的头撞在墙上已经半个小时了。任何帮助将不胜感激。

编辑:我正在使用 heroku:deploy

最佳答案

重复评论,以便将其标记为已回答。问题出在 pom.xml

中的 appName
<appName>my-app</appName>

这应该设置为您的 Heroku 应用程序的名称。

关于java - 无法使用 Maven 部署到 Heroku : Forbidden,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32190254/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com