我尝试使用Heroku Maven Plugin部署Spring Boot应用。
部署完成(mvn heroku:deploy
)。但是当我检查Heroku应用程序日志(heroku logs --tail
)时,我发现它没有找到Main类:
2017-10-03T23:50:45.702415+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -cp target/classes:target/dependency/* Main`
2017-10-03T23:50:48.064526+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2017-10-03T23:50:48.068505+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -Dfile.encoding=UTF-8
2017-10-03T23:50:48.237240+00:00 app[web.1]: Error: Could not find or load main class Main
2017-10-03T23:50:48.314862+00:00 heroku[web.1]: State changed from starting to crashed
2017-10-03T23:50:48.301181+00:00 heroku[web.1]: Process exited with status 1
我没有Procfile
(依赖默认值)。 Heroku Maven插件配置如下所示:
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>1.2.0</version>
<configuration>
<processTypes>
<web>java $JAVA_OPTS -cp target/classes:target/dependency/* Main</web>
</processTypes>
</configuration>
</plugin>
Main类路径是:
BASEPROJDIR/src/main/kotlin/com/virtualstand/ExplorerApplication.kt
答案 0 :(得分:1)
您需要确保主类的类路径是正确的: -
<configuration>
<processTypes>
<web>java $JAVA_OPTS -cp target/classes:target/dependency/* com.virtualstand.ExplorerApplication</web>
</processTypes>
</configuration>