java

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package java implements omnibump support for Java projects. Supports multiple build tools (Maven, Gradle, etc.)

Package java implements omnibump support for Java projects. Supports multiple build tools (Maven, Gradle, etc.) through a unified interface.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoBuildToolFound = errors.New("no supported Java build tool found")

ErrNoBuildToolFound is returned when no supported build tool is detected.

Functions

This section is empty.

Types

type BuildTool

type BuildTool interface {
	// Name returns the build tool identifier (e.g., "maven", "gradle")
	Name() string

	// Detect checks if this build tool is present in the given directory.
	// Returns true if manifest files for this build tool are found.
	Detect(ctx context.Context, dir string) (bool, error)

	// Update performs the dependency update using the provided configuration.
	Update(ctx context.Context, cfg *languages.UpdateConfig) error

	// Validate checks if the updates were applied successfully.
	Validate(ctx context.Context, cfg *languages.UpdateConfig) error

	// GetManifestFiles returns the list of manifest files for this build tool
	// (e.g., ["pom.xml"] for Maven, ["build.gradle"] for Gradle)
	GetManifestFiles() []string

	// GetAnalyzer returns an analyzer for this build tool, or nil if not supported.
	GetAnalyzer() analyzer.Analyzer
}

BuildTool defines the interface that each Java build tool must implement. This allows omnibump to support Maven, Gradle, and other Java build systems with a unified interface.

func DetectBuildToolFromPaths added in v0.17.0

func DetectBuildToolFromPaths(paths []string) BuildTool

DetectBuildToolFromPaths picks the Java build tool for a remote repository from its file path list, mirroring detectBuildTool's precedence without disk access: a tool with a manifest at the repository root wins (a root pom.xml beats a Gradle script elsewhere), otherwise the first registered tool with a matching manifest basename at any depth wins. Maven keeps priority at equal depth via registeredBuildTools order. Returns nil when no Java build tool matches.

Unlike detectBuildTool, a root pom.xml is accepted by name: remote detection only has paths, not content, so it cannot run maven.IsMavenPom. This matches how languages.DetectLanguageFromPaths already resolves remote Java repos.

type Java

type Java struct {
	// contains filtered or unexported fields
}

Java implements the Language interface for Java projects. It auto-detects the build tool (Maven, Gradle, etc.) and delegates to it.

func (*Java) Detect

func (j *Java) Detect(ctx context.Context, dir string) (bool, error)

Detect checks if any Java build tool is present in the directory.

func (*Java) GetBuildTool

func (j *Java) GetBuildTool(ctx context.Context, dir string) (BuildTool, error)

GetBuildTool returns the detected build tool. This is useful for the analyzer to get build tool-specific analyzers.

func (*Java) GetManifestFiles

func (j *Java) GetManifestFiles() []string

GetManifestFiles returns Java manifest files from the detected build tool.

func (*Java) Name

func (j *Java) Name() string

Name returns the language identifier.

func (*Java) SupportsAnalysis

func (j *Java) SupportsAnalysis() bool

SupportsAnalysis returns true since Java has analysis capabilities.

func (*Java) Update

func (j *Java) Update(ctx context.Context, cfg *languages.UpdateConfig) error

Update performs dependency updates on a Java project.

func (*Java) Validate

func (j *Java) Validate(ctx context.Context, cfg *languages.UpdateConfig) error

Validate checks if the updates were applied successfully.

Directories

Path Synopsis
Package gradle implements Gradle build tool support for Java projects.
Package gradle implements Gradle build tool support for Java projects.
Package maven implements Maven build tool support for Java projects.
Package maven implements Maven build tool support for Java projects.

Jump to

Keyboard shortcuts

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