在 heroku 上部署 Java 应用程序

标签 java maven heroku

我想我的 Procfile 有问题。我无法在 heroku 上部署我的应用程序,总是在日志中获取此信息:

2016-03-25T12:46:43.601893+00:00 heroku[web.1]: Starting process with command java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port 45751 target/*.war 2016-03-25T12:46:46.615217+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them. 2016-03-25T12:46:46.617375+00:00 app[web.1]: Error: Unable to access jarfile target/dependency/webapp-runner.jar 2016-03-25T12:46:47.819108+00:00 heroku[web.1]: Process exited with status 1 2016-03-25T12:46:47.877603+00:00 heroku[web.1]: State changed from starting to crashed

这是我的过程文件: 网络:java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war

这是我在 gitHub 上的项目

最佳答案

我在你的 pom 中没有看到 webapp-runner.jar。

Heroku 似乎也找不到这种依赖。

<!--  https://devcenter.heroku.com/articles/java-webapp-runner  -->
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.3</version>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>copy</goal>
                </goals>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>com.github.jsimone</groupId>
                            <artifactId>webapp-runner</artifactId>
                            <version>8.0.24.0</version>
                            <destFileName>webapp-runner.jar</destFileName>
                        </artifactItem>
                    </artifactItems>
                </configuration>
            </execution>
        </executions>
    </plugin>

关于在 heroku 上部署 Java 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36259051/

相关文章:

java - Jetty ProxyServlet 不重定向请求

java - 如何从扫描仪获取多个输入并将数字分配给一个值?

ruby-on-rails - 使用 Taglib-Ruby Gem (Rails 5) 部署到 Heroku

java - 在 Intellij CE 中,如何显示 Maven 选项卡?

mysql - 无法连接到生产环境中的 MySQL 数据库

java - c3p0 和 Heroku postgres,SSL 问题

java - 为什么我的组件不可见?

java - Android 模拟器失败

java - eclipse 之外的 maven java 构建错误

c++ - 使用 Maven NAR 插件对 ARM 进行交叉编译