Spring 的 Azure Pipeline Gradle 构建失败

2024-03-24

我尝试通过 Yaml 管道在 Azure 上构建和部署 Spring API。但我在 spring 应用程序 gradle 构建期间收到错误消息。

Error: /home/vsts/work/1/s/gradlew failed with return code: 1

找不到 org.springframework.boot:spring-data-rest-hal-browser:

扩大误差,

Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
> Could not find org.springframework.boot:spring-data-rest-hal-browser:.
  Required by:
      project :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 39s
1 actionable task: 1 executed
Error: /home/vsts/work/1/s/gradlew failed with return code: 1
    at ChildProcess.<anonymous> (/home/vsts/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.151.0/node_modules/vsts-task-lib/toolrunner.js:639:25)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
##[error]Error: /home/vsts/work/1/s/gradlew failed with return code: 1
##[section]Finishing: Gradle

我尝试过的事情。

我尝试在我的项目中更改指定 spring-data-rest-hal-browser 的版本。compile("org.springframework.boot:spring-data-rest-hal-browser") to compile("org.springframework.boot:spring-data-rest-hal-browser:2.4.0.RELEASE")最后compile("org.springframework.boot:spring-data-rest-hal-browser:3.0.8.RELEASE")

但仍然是相同的错误结果

这是我的存储库中当前的 build.gradle 文件

plugins {
    id 'org.springframework.boot' version '2.1.3.RELEASE'
    id 'java'
}

apply plugin: 'io.spring.dependency-management'

group = 'com.test.spring.api'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.11'

repositories {
    mavenCentral()
}

configurations {
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-rest'
    runtimeOnly 'mysql:mysql-connector-java'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    developmentOnly("org.springframework.boot:spring-boot-devtools")

    compile("org.springframework.boot:spring-boot-starter-data-rest")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile("org.springframework.boot:spring-data-rest-hal-browser")
    compile("org.springframework.data:spring-data-rest-webmvc:3.1.5.RELEASE")
}

这是我当前的 azure-pipelines.yml 文件

# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/java

trigger:
- master

pool:
  vmImage: 'Ubuntu-16.04'

steps:
- task: Gradle@2
  inputs:
    workingDirectory: '$(system.defaultWorkingDirectory)'
    gradleWrapperFile: 'gradlew'
    gradleOptions: '-Xmx3072m'
    javaHomeOption: 'JDKVersion'
    jdkVersionOption: '1.8'
    jdkArchitectureOption: 'x64'
    publishJUnitResults: false
    testResultsFiles: '**/TEST-*.xml'
    tasks: 'build'

- task: CopyFiles@2
  displayName: 'Copy Files to: Wireframe Directory on development server'
  inputs:
    SourceFolder: '$(Build.SourcesDirectory)'

    TargetFolder: '$(Build.ArtifactStagingDirectory)'

- script: 
      cd '$(Build.ArtifactStagingDirectory)';
      ls

- task: FtpUpload@1
  displayName: 'FTP Upload: $(Build.ArtifactStagingDirectory)'
  inputs:
    credentialsOption: inputs

    serverUrl: '[test server url]'

    username: '[test username] '

    password: '[test password] '

    rootDirectory: '$(Build.ArtifactStagingDirectory)'

    remoteDirectory: D:\home\site\wwwroot\webapps\ROOT\

    preservePaths: true

我希望能够通过 Azure DevOps 管道将代码推送到服务器 URL,从而自动将 Spring 应用程序部署到服务器 URL,该管道将构建和部署 Spring 应用程序。

Thanks


因此,我通过对 build.gradle 文件进行一些更改并使用来自的帮助构建管道来解决这个问题Github 上适用于 Intellij 的 Microsoft Azure 存储库:请参阅此处 https://github.com/Microsoft/azure-devops-intellij/blob/master/build.gradle

我的新 build.gradle 文件如下所示:

plugins {
    id 'org.jetbrains.intellij' version '0.4.1' apply false
    id 'org.springframework.boot' version '2.1.3.RELEASE'
    id 'java'
}

/**
 *This is task for update Gradle wrapper version.
 */
task wrapper(type: Wrapper) {
    gradleVersion = '4.7'
    distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}

apply plugin: 'io.spring.dependency-management'

group = 'com.test.spring.api'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

allprojects {

configurations {
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }
}

    repositories {
        mavenCentral()
    }
}

task unitTest(type: Test) {
    exclude '**/ApplicationTests/**'
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-rest'
    runtimeOnly 'mysql:mysql-connector-java'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    developmentOnly("org.springframework.boot:spring-boot-devtools")

    compile("org.springframework.boot:spring-boot-starter-data-rest")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile group: 'org.springframework.data', name: 'spring-data-rest-hal-browser', version: '3.0.8.RELEASE'
    compile("org.springframework.data:spring-data-rest-webmvc:3.1.5.RELEASE")
}

    tasks.withType(JavaCompile) {
        options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
    }

    tasks.withType(FindBugs) {
        ignoreFailures = true
        reports {
            html { enabled = true }
            xml.enabled = !html.enabled
        }
    }

    /**
     * Preparing for release build
     */
    task prepRelease() {
    }

还修改了 azure-pipelines.yml 文件以包含堆栈跟踪和信息,以帮助调试其他 gradle 和构建错误。

 tasks: 'build --stacktrace --info'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Spring 的 Azure Pipeline Gradle 构建失败 的相关文章

随机推荐

  • 位置:在reveal.js中固定

    我正在尝试为我的reveal js 演示文稿制作一个标题 使其粘贴在屏幕顶部 标题中的内容在每张幻灯片的基础上都是动态的 因此我必须将标记放置在部分标记内 显然 如果标记位于部分标记内 position fixed 并不能真正在 Revea
  • “模块”对象没有属性“form_for_model”

    当我使用属性时 模型的表单 我收到错误模块对象没有属性 form for model 我由此创建了该项目http www mikecantelon com q node 22 http www mikecantelon com q node
  • 具有联接和动态列的 SQL SERVER PIVOT 表

    我有一个问题需要调整 但遇到了麻烦 SQL Server 的版本为 2005 和 2008 查询源自公共表表达式 DECLARE cols AS NVARCHAR MAX query AS NVARCHAR MAX in iYearFrom
  • 将函数从纯 React 转换为 Redux React

    在纯反应中 我编写了一个调用的函数componentDidMount getTasks userId query statusTask pageNumber gt let check axios url api v1 beta userId
  • fortran 中的多重定义链接错误(ifort - gfortran)

    嗯 我有这个问题 描述很长 但我认为很容易解决 我有三个文件 nrtype f90 它有一些愚蠢的定义 但它被以下文件使用 module nrtype integer parameter I4B SELECTED INT KIND 9 in
  • 如果您强制推送到具有现有拉取请求的分支,会发生什么?

    我正在开发一个 git 分支 该分支目前是 github 上已关闭拉取请求的一部分 在最初的拉取请求之后 我做了一些额外的提交 将这些提交推送到 github 然后恢复这些提交并重新提交它们 因为我需要修改提交 现在 如果我想将这些提交推送
  • AVPlayer 消除了 Swift 2.2 中的观察者崩溃

    我有一个视频应用程序 是我在 Swift 1 中构建的 我一直在尝试迁移到 Swift 2 2 除了与观察者有关的奇怪崩溃之外 这一切 最终 都正常工作 func removeObservers print REMOVING OBSERVE
  • 两个 NSDate 之间的天数[重复]

    这个问题在这里已经有答案了 如何确定两次之间的天数NSDate值 也考虑到时间 The NSDate值可以是任何形式 NSDate date takes 具体来说 当用户在我的 iPhone 应用程序中进入非活动状态时 我存储以下值 exi
  • 如何检查变量是否是类的实例?

    在Java中 你可以这样做instanceof 有 Ruby 等价的吗 几乎一模一样 您可以使用Object s instance of method a instance of String gt true a instance of O
  • 使用 Perl split 函数,但保留某些分隔符

    我有一个字符串需要根据某个字符进行拆分 但是 当字符串两侧是数字时 我只需要在其中一个字符上拆分字符串 相同的字符存在于字符串中的其他位置 但两侧会有一个字母 至少在一侧 我尝试按如下方式使用 split 函数 使用 x 作为相关字符 my
  • 更改四开中的标题大小和颜色(html 输出)

    我有一个带有 HTML 渲染的四开文件 我想更改标题的大小和颜色 我应该如何操作 最小的例子 title Cars format html MTCars r head mtcars 您可以使用css直接在您的代码中 指定 title仅将更改
  • NuGet 打包和引用 dll

    背景 我有两个程序集 称为 A 和 B A 引用了 B A 还引用了一些其他 dll Microsoft Enterprise Library Data 和 Microsoft Enterprise Library Common 我认为这些
  • spring security - expiredUrl 不起作用

    我需要配置expired url在我的 Spring MVC 应用程序中 这是我的努力 但没有效果 Override protected void configure HttpSecurity http throws Exception h
  • 在 Android Studio 中调试 C++ 时“启动 LLDB 服务器”

    我想在 Android Studio 中调试 C 模块 我在 android studio 中创建了一个支持 C 的项目 When i debug this is what i get 启动 LLDB 服务器 永远不会停止 如果我停止调试
  • $_SERVER['document_root'] 返回 /htdocs 而不是 /public_html

    我正在寻找切换到新主机的机会 他们提供了这个不错的小 临时 URL 以便在切换之前测试您的文件 一切都很好 花花公子 所以我复制了所有文件 在每一页的顶部我require来自服务器的另一个文件 存储在public html includes
  • SQL 按匹配字段数对结果进行排序

    这里有一个复杂的 SQL 问题 我目前有一个匹配多个字段的 SELECT 语句 如下所示 SELECT field1 field2 field3 field4 field5 FROM table WHERE field1 variable
  • 转换为枚举与 Enum.ToObject

    我最近看到一个项目正在使用这个style SomeEnum Enum ToObject typeof SomeEnum some int 而不是这种风格 SomeEnum some int 为什么使用前者 这只是风格问题吗 来自 MSDN
  • intl 扩展名应该可用 symfony

    现在如果我去http localhost 8000 config php http localhost 8000 config php它告诉我 安装并启用 intl 扩展 用于验证器 所以我所做的是 Checked etc php 7 0
  • Mac App Store 应用程序 iTMSTransporter 错误

    我正在尝试将我的 pkg 文件发送给 Apple 但系统显示 Transporter 正在搜索更新的软件组件 并且该进程始终在运行 无法停止 这是我的活动日志 看起来像是上传错误 我已经安装了 iTMSTransporter 1 7 7 p
  • Spring 的 Azure Pipeline Gradle 构建失败

    我尝试通过 Yaml 管道在 Azure 上构建和部署 Spring API 但我在 spring 应用程序 gradle 构建期间收到错误消息 Error home vsts work 1 s gradlew failed with re