未能在heroku上部署战争 [英] Failed to deploy war on heroku

查看:134
本文介绍了未能在heroku上部署战争的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试将war部署到heroku
使用maven 3.2.5

trying to deploy war to heroku using maven 3.2.5

mvn clean heroku:deploy-war

获得此例外情况:

[ERROR] Failed to execute goal com.heroku.sdk:heroku-maven-plugin:0.3.0:deploy-war (default-cli) on project MyApp: Failed to deploy application: There was an exception invoking the remote service: HTTP(404): https://api.heroku.com/apps/MyApp/config-vars -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.heroku.sdk:heroku-maven-plugin:0.3.0:deploy-war (default-cli) on project MyApp: 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:355)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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.DeployWarMojo.execute(DeployWarMojo.java:58)
    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: com.heroku.sdk.deploy.Curl$CurlException: There was an exception invoking the remote service: HTTP(404)
    at com.heroku.sdk.deploy.Curl.handleResponse(Curl.java:94)
    at com.heroku.sdk.deploy.Curl.get(Curl.java:22)
    at com.heroku.sdk.deploy.App.getConfigVars(App.java:139)
    at com.heroku.sdk.deploy.App.deploy(App.java:77)
    at com.heroku.sdk.deploy.App.deploy(App.java:93)
    at com.heroku.sdk.deploy.WarApp.deploy(WarApp.java:38)
    at com.heroku.sdk.maven.DeployWarMojo.execute(DeployWarMojo.java:54)
    ... 21 more
Caused by: java.io.FileNotFoundException: https://api.heroku.com/apps/MyApp/config-vars
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1624)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at com.heroku.sdk.deploy.Curl.handleResponse(Curl.java:90)
    ... 27 more

这就是我的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>com.avi</groupId>
    <artifactId>MyApp</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <description>My GoTickets Web App</description>
    <inceptionYear>2014</inceptionYear>
    <properties>
        <scala.version>2.11.4</scala.version>
        <spray.version>1.3.1</spray.version>
        <akka.version>2.3.8</akka.version>
    </properties>

    <repositories>
        <repository>
            <id>scala-tools.org</id>
            <name>Scala-Tools Maven2 Repository</name>
            <url>http://scala-tools.org/repo-releases</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>scala-tools.org</id>
            <name>Scala-Tools Maven2 Repository</name>
            <url>http://scala-tools.org/repo-releases</url>
        </pluginRepository>

    </pluginRepositories>

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.9</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <scope>test</scope>
            <groupId>org.specs2</groupId>
            <artifactId>specs2-core_2.11</artifactId>
            <version>2.4.15</version>
        </dependency>
        <dependency>
            <scope>test</scope>
            <groupId>com.typesafe.akka</groupId>
            <artifactId>akka-testkit_2.11</artifactId>
            <version>${akka.version}</version>
        </dependency>
        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_2.11</artifactId>
            <version>2.2.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.spray</groupId>
            <artifactId>spray-can</artifactId>
            <version>${spray.version}</version>
        </dependency>
        <dependency>
            <groupId>io.spray</groupId>
            <artifactId>spray-routing</artifactId>
            <version>${spray.version}</version>
        </dependency>
        <dependency>
            <groupId>io.spray</groupId>
            <artifactId>spray-json_2.11</artifactId>
            <version>${spray.version}</version>
        </dependency>
        <dependency>
            <groupId>com.typesafe.akka</groupId>
            <artifactId>akka-actor_2.11</artifactId>
            <version>${akka.version}</version>
        </dependency>
        <dependency>
            <groupId>com.typesafe.akka</groupId>
            <artifactId>akka-slf4j_2.11</artifactId>
            <version>${akka.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.5</version>
        </dependency>

    </dependencies>

    <build>
        <sourceDirectory>src/main/scala</sourceDirectory>
        <testSourceDirectory>src/test/scala</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <scalaVersion>${scala.version}</scalaVersion>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.heroku.sdk</groupId>
                <artifactId>heroku-maven-plugin</artifactId>
                <version>0.3.0</version>
                <configuration>
                    <appName>MyApp</appName>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


推荐答案

您的 appName 在Heroku 插件配置中不正确。 Heroku应用程序必须以字母开头,并且只能包含小写字母,数字和破折号。因此, MyApp 不能正确。

Your appName is incorrect in the Heroku plugin configuration. Heroku apps must start with a letter and can only contain lowercase letters, numbers, and dashes. Therefore MyApp cannot be correct.

在Heroku仪表板中查看您的应用程序页面,然后查找您的应用程序的名称,然后相应地更新配置。下面是一个带有随机命名的Heroku应用程序的插件配置示例:

Check your apps page in the Heroku dashboard and find the name of your application then update the configuration accordingly. Here is an example of the plugin config with a randomly named Heroku app:

<plugin>
    <groupId>com.heroku.sdk</groupId>
    <artifactId>heroku-maven-plugin</artifactId>
    <version>0.3.0</version>
    <configuration>
        <appName>hidden-badlands-1234</appName>
    </configuration>
</plugin>

这篇关于未能在heroku上部署战争的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆