我想在heroku中部署一个spring boot项目。部署成功,因为它的构建触发并构建成功。然后我添加procfile来运行它。这是我的procfile:
web: java $JAVA_OPTS -Dserver.port=$PORT -jar target/*.jar
我的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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>palebluedotstardust</groupId>
<artifactId>BloodDB</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>BloodDB</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org.slf4j.version>1.7.7</org.slf4j.version>
<javax.servlet-api.version>2.5</javax.servlet-api.version>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
<java.version>1.8</java.version>
<!--<commons-dbcp.version>1.4</commons-dbcp.version>-->
</properties>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
<repositories>
...........
这是日志:
2017-03-16T05:04:02.185944+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -Dserver.port=16048 -jar target/*.jar`
2017-03-16T05:04:04.368304+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2017-03-16T05:04:04.369353+00:00 app[web.1]: Error: Unable to access jarfile target/*.jar
2017-03-16T05:04:04.469613+00:00 heroku[web.1]: State changed from starting to crashed
2017-03-16T05:04:04.456272+00:00 heroku[web.1]: Process exited with status 1
答案 0 :(得分:0)
您的包装上写着<packaging>war</packaging>
,因此您没有要执行的jar文件。
这里是关于如何部署战争伪像的文档