英文:
Why can I not publish Spring Boot Web Service to MS Azure?
问题
我和我的学生在将Java SpringBoot Web服务发布到按需付费的Azure订阅时遇到了问题。我们正在遵循Microsoft的learn.microsoft.com网站上的指导。我们一直收到invalid target release: 17的错误消息。
这是我的代码:https://github.com/leecottrellPTC/Azurepublish.git
这是Microsoft的代码:https://github.com/spring-guides/gs-spring-boot
Azure CLI中的Java版本是Java 11。我已尝试在本地将项目重建为Java版本8、11和17。每次都能在本地服务器上运行。但当我重新发布到Azure时,在向导中进行了正确的版本选择。我尝试了Linux和Windows操作系统,以及几个不同的支付层次,但都导致相同的错误。
Microsoft的链接提供了四种不同的发布Web服务的方式。除了Docker,我已尝试它们所有。我没有配置Docker。
我已运行了mvn package azure-webapp:deploy -e,但收到了一系列错误信息。
我不知道还能做什么。
英文:
My students and I are having problems posting a Java SpringBoot web service to my pay as you go Azure subscription. We are following microsoft's directions from their learn.microsoft.com site. We keep receiving invalid target release: 17
This is my code <https://github.com/leecottrellPTC/Azurepublish.git>
This is MS's code <https://github.com/spring-guides/gs-spring-boot>
The version of Java in the Azure CLI is Java 11. I have tried rebuilding my project locally to Java versions 8, 11, and 17. Each time, it runs on my local servers. When I republish it to Azure, I make the proper version choices in the wizard. I have tried Linux and Windows OS, and several tiers of pay. Each results in the same error.
The MS Link offers four different ways to publish a web service. I have tried them all with the exception of Docker. I do not have that configured.
I have run the mvn package azure-webapp:deploy -e, receiving a vomit of errors.
I do not know what else to do.
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project azurehotel: Fatal error compiling: error: invalid target release: 17 -\> \[Help 1\]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project azurehotel: Fatal error compiling
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1220)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:198)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.codehaus.plexus.compiler.CompilerException: error: invalid target release: 17
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:197)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:182)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1209)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:198)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.IllegalArgumentException: error: invalid target release: 17
at com.sun.tools.javac.main.Arguments.error (Arguments.java:907)
at com.sun.tools.javac.main.Arguments.doProcessArgs (Arguments.java:383)
at com.sun.tools.javac.main.Arguments.processArgs (Arguments.java:347)
at com.sun.tools.javac.main.Arguments.init (Arguments.java:246)
at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:185)
at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:119)
at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:68)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:135)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:182)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1209)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:198)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
\[ERROR\]
\[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\] </kbd><kbd>http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
答案1
得分: 0
尝试将 pom.xml 中的这部分代码更改为:
<properties>
<java.version>11</java.version>
</properties>
Spring-Boot 3 需要 Java 17,因此您需要将 Spring-Boot 降级为版本2。如果这不是一个选项,您可以保持 pom.xml 不变,但需要将 Azure CLI 版本更改为17。
英文:
Try changing this in your pom.xml:
<properties>
<java.version>17</java.version>
</properties>
To this:
<properties>
<java.version>11</java.version>
</properties>
Spring-Boot 3 does require Java 17, so you'll need to downgrade to Spring-Boot 2. If that's not an option, you'll keep the pom.xml the same and change the Azure cli version to 17.
答案2
得分: 0
降级到Spring Boot 2.7.10-snapshot成功。我成功地将Web服务从GitHub迁移到Azure。
我成功地将Azure CLI升级到Java 17,但它不允许服务发布。
英文:
Downgrading to Spring boot 2.7.10-snapshot worked. I was able to successfully transfer the web service from GitHub to Azure.
I was able to successfully upgrade the Azure cli to java 17, but it did not allow the service to post.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论