首页 > 解决方案 > 在 Windows 上使用 Gradle axion 发布失败,但在 Linux 上有效

问题描述

嗨,只是尝试使用 axion 插件的简单代码。

虽然,相同的代码在 Linux 上运行良好。我正在使用 GIT 版本 - “git 版本 2.32.0.windows.1” Gradle 版本 - “Gradle 7.2” axion-release 版本“1.13.2”。我的 build.gradle 看起来像 -

plugins {
    id 'org.springframework.boot' version '2.5.5'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
    id "pl.allegro.tech.build.axion-release" version "1.13.2"
}
group = 'com.spring.exercise'
 
scmVersion {
    versionCreator "versionWithBranch"
}
 
version = scmVersion.version
  
sourceCompatibility = '1.8'


configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-rest'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
    useJUnitPlatform()
}

我也尝试从 GitBash 运行命令,但出现错误 -

$ ./gradlew release --info
Initialized native services in: C:\Users\Naruto\.gradle\native
Initialized jansi services in: C:\Users\Naruto\.gradle\native
The client will now receive all logging from the daemon (pid: 6204). The daemon log file: C:\Users\Naruto\.gradle\daemon\7.2\daemon-6204.out.log
Starting 50th build in daemon [uptime: 5 hrs 30 mins 51.32 secs, performance: 100%, non-heap usage: 27% of 256 MiB]
Using 8 worker leases.
Now considering [F:\Self-Study-Coding-Practices\spring-exercise] as hierarchies to watch
Not watching anything anymore
Watching the file system is configured to be enabled if available
File system watching is active
>>>>>>>>>>> This is being executed in Gradle's Initialization Phase. We have created this script at C:/Users/Naruto/.gradle/init.d/another.gradle
Executing from Init.Gradle
Starting Build
Settings evaluated using settings file 'F:\Self-Study-Coding-Practices\spring-exercise\settings.gradle'.
Projects loaded. Root project using build file 'F:\Self-Study-Coding-Practices\spring-exercise\build.gradle'.
Included projects: [root project 'spring-exercise']

> Configure project :
Evaluating root project 'spring-exercise' using build file 'F:\Self-Study-Coding-Practices\spring-exercise\build.gradle'.
Applying dependency management to configuration 'bootArchives' in project 'spring-exercise'
Applying dependency management to configuration 'archives' in project 'spring-exercise'
Applying dependency management to configuration 'default' in project 'spring-exercise'
Applying dependency management to configuration 'implementation' in project 'spring-exercise'
Applying dependency management to configuration 'compileOnly' in project 'spring-exercise'
Applying dependency management to configuration 'compileClasspath' in project 'spring-exercise'
Applying dependency management to configuration 'annotationProcessor' in project 'spring-exercise'
Applying dependency management to configuration 'runtimeOnly' in project 'spring-exercise'
Applying dependency management to configuration 'runtimeClasspath' in project 'spring-exercise'
Applying dependency management to configuration 'testImplementation' in project 'spring-exercise'
Applying dependency management to configuration 'testCompileOnly' in project 'spring-exercise'
Applying dependency management to configuration 'testCompileClasspath' in project 'spring-exercise'
Applying dependency management to configuration 'testAnnotationProcessor' in project 'spring-exercise'
Applying dependency management to configuration 'testRuntimeOnly' in project 'spring-exercise'
Applying dependency management to configuration 'testRuntimeClasspath' in project 'spring-exercise'
Applying dependency management to configuration 'apiElements' in project 'spring-exercise'
Applying dependency management to configuration 'runtimeElements' in project 'spring-exercise'
Applying dependency management to configuration 'developmentOnly' in project 'spring-exercise'
Applying dependency management to configuration 'productionRuntimeClasspath' in project 'spring-exercise'
All projects evaluated.
Selected primary task 'release' from project :
Tasks to be executed: [task ':verifyRelease', task ':release']
Tasks that were excluded: []
:verifyRelease (Thread[Execution worker for ':',5,main]) started.

> Task :verifyRelease
Caching disabled for task ':verifyRelease' because:
  Build cache is disabled
Task ':verifyRelease' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
Looking for uncommitted changes..
Checking if branch is ahead of remote..
Checking for snapshot versions..
:verifyRelease (Thread[Execution worker for ':',5,main]) completed. Took 0.008 secs.
:release (Thread[Execution worker for ':',5,main]) started.

> Task :release
Caching disabled for task ':release' because:
  Build cache is disabled
Task ':release' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
Creating tag: v0.1.5
Pushing all to remote: origin
Trying to connect any to SSH agent for repository credentials
Failed to use ssh-agent as identity provider, see debug logs for details
Successfully connected to SSH agent and fetched identities, see debug logs for details
Trying to connect any to SSH agent for repository credentials
Failed to use ssh-agent as identity provider, see debug logs for details
Successfully connected to SSH agent and fetched identities, see debug logs for details
Removing tag: v0.1.5
Tag v0.1.5 removed
remote message:

> Task :release FAILED
:release (Thread[Execution worker for ':',5,main]) completed. Took 3.851 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':release'.
> pl.allegro.tech.build.axion.release.ReleaseFailedException (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --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 5s
2 actionable tasks: 2 executed
Not watching anything anymore
Watched directory hierarchies: []

标签: javaspringgradlewindows-10axion-release-plugin

解决方案


推荐阅读