【问题标题】:Unable to deploy Spring-boot app to Azure App Service无法将 Spring-boot 应用部署到 Azure 应用服务
【发布时间】:2021-02-07 01:26:51
【问题描述】:

这是我第一次部署到 Azure。我一直在尝试将我的 spring-boot 应用程序部署到 Azure App 服务。我已经按照所有这些步骤...

  1. az 登录
  2. az ad sp create-for-rbac --name "app-name" --password "password"
  3. 更新 settings.xml
  4. mvn azure-webapp:config
  5. mvn clean package azure-webapp:deploy

但我收到以下错误..... [错误] 无法在项目 AppName 上执行目标 com.microsoft.azure:azure-webapp-maven-plugin:1.8.0:deploy (default-cli):根据资源过滤器“资源{targetPath”在目标文件夹中找不到可执行 jar : C:\xxxxxx\AppName\target\azure-webapp\xxxx-spring-app-539b496b-9dfc-4201-8ffd-44b828cad6b8, 过滤: false, FileSet {目录: C:\xxxxxx\AppName\target, PatternSet [包括: {*.jar}, excludes: {}]}}',请确保资源过滤器是正确的并且你已经构建了 jar。 -> [帮助 1]

我的 jar 在 C:\xxxxxx\AppName\target 文件夹中创建,但部署到 Azure 失败。我错过了什么??

【问题讨论】:

    标签: azure spring-boot-maven-plugin


    【解决方案1】:

    发布解决方案以防万一有人遇到同样的问题....

    错误是由于清单文件中缺少 Main-Class 条目。 将此条目添加到 pom.xml 解决了该问题。

    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <archive>
                            <manifest>
                                <mainClass>app.com.MainClass</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin> 
    

    【讨论】:

      猜你喜欢
      • 2016-06-13
      • 2021-05-18
      • 2018-05-21
      • 1970-01-01
      • 2021-11-29
      • 1970-01-01
      • 2020-04-13
      • 2020-05-28
      • 1970-01-01
      相关资源
      最近更新 更多