sorry if this is a duplicate. I couldn't find answer anywhere.
如果这是复制品,很抱歉。我到处都找不到答案。
I'm giving Heroku a try. I'm trying to deploy a demo Java Spring Boot REST API to it and I'm not having any luck.
我在给Heroku一个机会我试图部署一个演示Java Spring Boot REST API到它,我没有任何运气。
You can view my pom.xml here. And the various things I tried in the git log if you're interested. Otherwise my pom.xml is below. I've got heroku setup to automatically deploy from this repository branch.
您可以在此处查看我的pom.xml。如果你感兴趣的话还有我在GIT日志中尝试过的各种事情。否则,我的pom.xml将显示在下面。我已经将Heroku设置为从这个存储库分支自动部署。
https://github.com/tomdemay/UserMgmtPortal/blob/master/user-mgmt-backend/pom.xml
Https://github.com/tomdemay/UserMgmtPortal/blob/master/user-mgmt-backend/pom.xml
I have no problems building or running in my environment. This pom file was generated by the spring initializer about 2 weeks ago.
我在我的环境中构建或运行没有任何问题。这个POM文件是由Spring初始化器在大约两周前生成的。
[INFO] Changes detected - recompiling the module! :dependency
[INFO] Compiling 11 source files with javac [debug release 17] to target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.845 s
[INFO] Finished at: 2023-07-22T03:08:15Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project user-mgmt-backend: Fatal error compiling: invalid flag: --release -> [Help 1]
[ERROR]
my POM.xml
我的POM.xml
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.1</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<groupId>com.tomdemay.pro
</groupId>
<artifactId>user-mgmt-backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>user-mgmt-backend</name>
<description>User Management Portal Backend</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>5.7.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>4.0.0-M9</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.0</version>
</plugin>
</plugins>
</build>
<packaging>jar</packaging>
</project>
更多回答
优秀答案推荐
Create a system.properties file at the root of your project with this line
使用下面的代码行在项目的根目录下创建一个Syst.Properties文件
java.runtime.version=17
See https://devcenter.heroku.com/changelog-items/2268
请参阅https://devcenter.heroku.com/changelog-items/2268
更多回答
我是一名优秀的程序员,十分优秀!