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 ¶
- Variables
- type BuildTool
- type Java
- func (j *Java) Detect(ctx context.Context, dir string) (bool, error)
- func (j *Java) GetBuildTool(ctx context.Context, dir string) (BuildTool, error)
- func (j *Java) GetManifestFiles() []string
- func (j *Java) Name() string
- func (j *Java) SupportsAnalysis() bool
- func (j *Java) Update(ctx context.Context, cfg *languages.UpdateConfig) error
- func (j *Java) Validate(ctx context.Context, cfg *languages.UpdateConfig) error
Constants ¶
This section is empty.
Variables ¶
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
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) GetBuildTool ¶
GetBuildTool returns the detected build tool. This is useful for the analyzer to get build tool-specific analyzers.
func (*Java) GetManifestFiles ¶
GetManifestFiles returns Java manifest files from the detected build tool.
func (*Java) SupportsAnalysis ¶
SupportsAnalysis returns true since Java has analysis capabilities.
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. |