mavenutil

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2025 License: Apache-2.0, BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package mavenutil provides utilities for merging Maven pom/xml.

Index

Constants

View Source
const (
	OriginManagement = "management"
	OriginParent     = "parent"
	OriginPlugin     = "plugin"
	OriginProfile    = "profile"
)

Origin of the dependencies.

View Source
const MaxParent = 100

MaxParent sets a limit on the number of parents to avoid indefinite loop.

Variables

This section is empty.

Functions

func CompareVersions added in v0.1.7

func CompareVersions(vk resolve.VersionKey, a *semver.Version, b *semver.Version) int

CompareVersions compares two Maven semver versions with special behaviour for specific packages, producing more desirable ordering using non-standard comparison.

func GetDependencyManagement

func GetDependencyManagement(ctx context.Context, client *datasource.MavenRegistryAPIClient, groupID, artifactID, version maven.String) (maven.DependencyManagement, error)

GetDependencyManagement returns managed dependencies in the specified Maven project by fetching remote pom.xml.

func IsPrerelease added in v0.3.2

func IsPrerelease(ver *semver.Version, vk resolve.VersionKey) bool

IsPrerelease returns whether the given version is a prerelease version. There is a special handling for com.google.guava:guava, which has 'flavors' with versions ending with '-jre' or '-android'. These versions are not considered as prerelease versions.

func MergeParents

func MergeParents(ctx context.Context, current maven.Parent, result *maven.Project, opts Options) error

MergeParents parses local accessible parent pom.xml or fetches it from upstream, merges into root project, then interpolate the properties.

  • current holds the current parent project to merge.
  • result holds the Maven project to merge into, this is modified in place.
  • opts holds the options for merging parent data.

func ParentPOMPath added in v0.1.8

func ParentPOMPath(input *filesystem.ScanInput, currentPath, relativePath string) string

ParentPOMPath returns the path of a parent pom.xml. Maven looks for the parent POM first in 'relativePath', then the local repository '../pom.xml', and lastly in the remote repo. An empty string is returned if failed to resolve the parent path.

func ProjectKey

func ProjectKey(proj maven.Project) maven.ProjectKey

ProjectKey returns a project key with empty groupId/version filled by corresponding fields in parent.

Types

type Options added in v0.1.8

type Options struct {
	Input  *filesystem.ScanInput
	Client *datasource.MavenRegistryAPIClient

	AddRegistry        bool
	AllowLocal         bool
	InitialParentIndex int
}

Options for merging parent data.

  • Input is the scan input for the current project.
  • Client is the Maven registry API client for fetching remote pom.xml.
  • AllowLocal indicates whether parsing local parent pom.xml is allowed.
  • InitialParentIndex indicates the index of the current parent project, which is used to check if the packaging has to be `pom`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL