Home > database >  What's the successor of `org.gradle.util.VersionNumber`
What's the successor of `org.gradle.util.VersionNumber`

Time:11-16

In gradle 7.3, I found the following source code:

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> {
...

So is this feature dropped or moved? What's the new way of using VersionNumber related functionality?

CodePudding user response:

That class and many others in the util package were not intended to be used in plugins or anything outside of Gradle's codebase.

In #16745, the Gradle team formally deprecated many of the utility classes and moved/copied them into an internal utility package. Some utility classes have replacements as noted in their respective Javadoc, but some such as VersionNumber have no public replacement provided by Gradle. As such, this should be considered a private API and you should not use it anywhere in your project's build or plugins.

As an alternative, you can use a semver library of your choosing as a replacement.

  • Related