生成失败Heroku java

ctzwtxfj  于 2022-11-13  发布在  Java
关注(0)|答案(2)|浏览(152)

我有问题部署项目java. i配置pom.xml版本jar 11和mvn 3.8.1。我在本地构建成功的项目,所以当我在heroku部署。我需要做什么?

[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/2.8.4/plexus-compiler-javac-2.8.4.jar (21 kB at 211 kB/s)
   [INFO] Changes detected - recompiling the module!
   [INFO] Compiling 149 source files to /tmp/build_740f92f8/target/classes
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD FAILURE
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time:  10.581 s
   [INFO] Finished at: 2022-10-14T02:29:49Z
   [INFO] ------------------------------------------------------------------------
   [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project NCKHSV: Fatal error compiling: invalid flag: --release -> [Help 1]
   [ERROR] 
   [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
   [ERROR] Re-run Maven using the -X switch to enable full debug logging.
   [ERROR] 
   [ERROR] For more information about the errors and possible solutions, please read the following articles:
   [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

!错误:无法使用Maven构建应用程序很抱歉,此构建失败!如果您在应用程序代码中找不到问题,请提交一个票证,以便我们可以提供帮助:https://help.heroku.com/!推送被拒绝,无法编译Java应用程序。!推送失败

uoifb46i

uoifb46i1#

问题是heroku目前使用的Java 8:Heroku Java版本
指示器为以下行:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project NCKHSV: Fatal error compiling: invalid flag: --release -> [Help 1]
我在构建目标是Java11但运行JDK是Java8的Maven应用程序时遇到过这个问题。我无法帮助使用heroku,因为我还没有使用过它

68bkxrlz

68bkxrlz2#

在heroku,您可以使用下面pom.xml中的配置,请仔细查看。:)
请检查<project>下pom.xml中提到的maven插件。

...
    <packaging>maven-plugin</packaging>
</project>

进一步请检查这个插件,您可以替换下面的插件代码,并根据您的需要进行修改。它可以添加到build->plugins->THIS_PLUGIN

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.6.4</version>
                <configuration>
                    <!-- see http://jira.codehaus.org/browse/MNG-5346 -->
                    <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                </configuration>
                <executions>
                    <execution>
                        <id>default-descriptor</id>
                        <phase>process-classes</phase>
                    </execution>
                    <execution>
                        <id>help-descriptor</id>
                        <phase>process-classes</phase>
                    </execution>
                    <execution>
                        <id>mojo-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

另外,请在您的pom.xml中添加以下依赖项,在“依赖项-〉THIS DEPENDENCY”下

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>2.7.4</version>
        </dependency>

我希望,它能帮上忙!

相关问题