【问题标题】:What's the successor of `org.gradle.util.VersionNumber`org.gradle.util.VersionNumber 的继承者是什么
【发布时间】:2021-12-26 06:37:01
【问题描述】:

在gradle 7.3中,我找到了如下源码:

package org.gradle.util;

import com.google.common.base.Objects;
import com.google.common.collect.Ordering;

import javax.annotation.Nullable;

/**
 * This class is only here to maintain binary compatibility with existing plugins.
 *
 * @deprecated Will be removed in Gradle 8.0.
 */
@Deprecated
public class VersionNumber implements Comparable<VersionNumber> {
...

那么这个功能是被删除还是被移动了?使用 VersionNumber 相关功能的新方法是什么?

【问题讨论】:

    标签: gradle versioning


    【解决方案1】:

    util 包中的该类和许多其他类不打算用于插件或 Gradle 代码库之外的任何内容。

    #16745 中,Gradle 团队正式弃用了许多实用程序类,并将它们移动/复制到内部实用程序包中。一些实用程序类在其各自的 Javadoc 中注明了替代品,但一些如 VersionNumber 没有 Gradle 提供的公共替代品。因此,这应被视为私有 API,您不应在项目的构建或插件中的任何地方使用它。

    作为替代方案,您可以使用您选择的 semver 库作为替代。

    【讨论】:

    • 非常感谢!很快就会迁移到它
    猜你喜欢
    • 2020-06-29
    • 1970-01-01
    • 2011-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-24
    • 2011-08-20
    相关资源
    最近更新 更多