Heroku找不到webapp-runner.jar [英] Heroku can't find webapp-runner.jar
问题描述
我有一个Spring Web应用程序,我想将其部署到Heroku.这是pom.xml:
I've got a Spring web app which I want to deploy to Heroku. Here's the pom.xml:
<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>
...
<dependencies>
...(spring, hibernate, junit, freemarker)
</dependencies>
<build>
<!-- static final name for easy integration with IDEs -->
<finalName>web-app</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>web</warSourceDirectory>
</configuration>
</plugin>
<!-- webapp-runner.jar for running the app -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</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.5.11.2</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
这是项目根目录中的Procfile:
Here is the Procfile in project root directory:
web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war
在本地一切都很好,我成功地将其推送到了heroku. Git输出:
Everything is fine locally, and I successfully push it to heroku. Git output:
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> JVM Common app detected
remote: -----> Installing OpenJDK 1.8... done
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 49.1M
remote: -----> Launching...
...
remote: Verifying deploy... done.
但是随后heroku日志告诉我:
But then heroku logs tells me:
Error: Unable to access jarfile target/dependency/webapp-runner.jar
我试图清理并运行Procfile中的确切命令,并且在我的本地计算机上一切正常.那么这里可能有什么问题呢?
I tried to clean and run the exact command in the Procfile, and everything went just fine on my local machine. So what can be a problem here?
推荐答案
运行以下命令来更改您的buildpack:
Run this command to change your buildpack:
$ heroku buildpacks:set heroku/java
然后再次git push
.
现在,您的应用程序使用的是JVM buildpack,它没有运行Maven.尝试使用heroku deploy:war
或Heroku Maven插件时,可能采用这种方式.
Right now, your app is using the JVM buildpack, which doesn't run Maven. It probably got this way when you tried heroku deploy:war
or the Heroku Maven plugin.
这篇关于Heroku找不到webapp-runner.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!