我正在尝试使用Heroku Maven插件将Java jar部署到Heroku。由于我使用的是Java 11,所以我在根文件夹(pom.xml所在位置)中添加了system.properties并设置了java.runtime.version = 11 。然而它似乎没有起作用!
我的插件:
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<includeTarget>false</includeTarget>
<includes>
<include>${project.build.directory}/${project.build.finalName}.jar</include>
</includes>
<processTypes>
<web>java $JAVA_OPTS -jar ${project.build.directory}/${project.build.finalName}.jar</web>
</processTypes>
</configuration>
</plugin>
当我执行 git push heroku master 命令时,它会使用jdk 8开始构建过程。
remote: Building source:
remote:
remote: -----> Java app detected
remote: -----> Installing JDK 1.8... done
remote: -----> Installing Maven 3.6.2... done
remote: -----> Executing Maven
remote: $ mvn -DskipTests clean dependency:list install
最终构建失败,错误为:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project ImpactHub_bot: Fatal error compiling: invalid flag: --release ->
如何将 JDK 版本设置为 11?我已经尝试在配置中添加 ${java.version},但没有帮助。