1

I'm trying to deploy a jar with dependencies to Heroku, using the Heroku Maven plugin. I'm getting this error message:

[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

Which I can't find out how to fix. What exactly is forbidden? This is my 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>

Been beating my head against the wall for half an hour now. Any help would be greatly appreciated.

Edit: I'm using heroku:deploy

  • What command are you running (i.e. `mvn heroku:deploy`)? Do you have permission to deploy to "my-app"? Make sure you have created a Heroku app (on http://dashboard.heroku.com) and that you have that name configured in the `pom.xml`. – codefinger Aug 24 '15 at 19:39
  • I'm using heroku:deploy, yes. How can I check if I have permission (why wouldn't I have?). I noticed now that my app on the heroku-dashboard does not match the name in my pom, the heroku-dashboard name is auto-generated for some reason. –  Aug 24 '15 at 20:03
  • Thanks, it was as easy as fixing the appName parameter :) –  Aug 24 '15 at 20:54

1 Answers1

2

Repeating the comments so this can be marked as answered. The problem was the appName in the pom.xml

<appName>my-app</appName>

This should be set to the name of your Heroku app.

codefinger
  • 10,088
  • 7
  • 39
  • 51