【发布时间】:2023-04-08 11:44:01
【问题描述】:
尝试在 heroku 上部署我的应用时,我不断收到错误消息。
这是我的 pom.xml(构建部分):
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<verbose>true</verbose>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
<contextReloadable>true</contextReloadable>
</configuration>
</plugin>
<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>
</plugins>
</build>
这是我的 Procfile:
web: java $JAVA_OPTS -jar target/dependency/web-runner.jar --port $PORT target /*.war
我不断收到此错误:
错误:无法访问 jarfile 目标/依赖项/web-runner.jar 2020-04-27T22:38:02.611229+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=joke-generator76.herokuapp.com request_id=53d259d1 -f2a7-469f-bc09-efb6019f42f1 fwd="89.76.117.177" dyno= connect= service= status=503 bytes= protocol=https 2020-04-27T22:38:02.731866+00:00 heroku[路由器]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=joke-generator76.herokuapp.com request_id=9b168a99-3bd1-4d15-bcf7-da703b4cd070 fwd="89.76.117.177" dyno= connect= service= status=503 bytes= protocol=https
所以,我想,由于某种我无法理解的原因,它无法访问 jarfile。
有人知道问题可能是什么吗?我搜索了所有官方 heroku 的文档、各种开发博客、其他论坛等。我尝试了多种解决方案,但没有任何效果。
如果我发现的信息是可信的,我在这里提供的代码实际上是许多人解决它给我带来的问题的原因。
此外,应用程序在 localhost 上运行没有任何问题。
请帮忙。
【问题讨论】:
标签: java maven heroku dependencies