Documentation
¶
Overview ¶
Package maven implements Maven build tool support for Java projects. Ported from pombump with enhancements for the unified omnibump architecture.
Index ¶
- Constants
- Variables
- func ParsePom(pomPath string) (*gopom.Project, error)
- func PatchProject(ctx context.Context, project *gopom.Project, patches []Patch, ...) (*gopom.Project, error)
- func UpdatePom(ctx context.Context, pomPath string, patches []Patch, ...) ([]byte, error)
- type Maven
- func (m *Maven) Detect(ctx context.Context, dir string) (bool, error)
- func (m *Maven) GetAnalyzer() analyzer.Analyzer
- func (m *Maven) GetManifestFiles() []string
- func (m *Maven) Name() string
- func (m *Maven) Update(ctx context.Context, cfg *languages.UpdateConfig) error
- func (m *Maven) Validate(ctx context.Context, cfg *languages.UpdateConfig) error
- type MavenAnalyzer
- func (ma *MavenAnalyzer) Analyze(ctx context.Context, projectPath string) (*analyzer.AnalysisResult, error)
- func (ma *MavenAnalyzer) AnalyzeRemote(ctx context.Context, files map[string][]byte) (*analyzer.RemoteAnalysisResult, error)
- func (ma *MavenAnalyzer) RecommendStrategy(ctx context.Context, analysis *analyzer.AnalysisResult, ...) (*analyzer.Strategy, error)
- type Patch
- type PatchList
- type PropertyList
- type PropertyPatch
Constants ¶
const ( // MaxPatchFileSize limits patch/properties file size to prevent resource exhaustion. MaxPatchFileSize = 10 * 1024 * 1024 // 10 MB // MaxPomFileSize limits POM file size to prevent resource exhaustion. MaxPomFileSize = 10 * 1024 * 1024 // 10 MB )
Default scope and type for a dependency.
Variables ¶
var ( // ErrInvalidVersion is returned when a version string fails validation. ErrInvalidVersion = errors.New("invalid version string") // ErrPomNotFound is returned when pom.xml is not found. ErrPomNotFound = errors.New("pom.xml not found") // ErrPropertyValidationFailed is returned when property validation fails. ErrPropertyValidationFailed = errors.New("property validation failed") // ErrRemoteAnalysisNotImplemented is returned when remote analysis is not implemented. ErrRemoteAnalysisNotImplemented = errors.New("remote analysis not yet implemented") // ErrMissingRequiredFields is returned when a dependency is missing groupId or artifactId. ErrMissingRequiredFields = errors.New("missing required fields for dependency") )
var ( // ErrProjectNil is returned when a POM project is nil. ErrProjectNil = errors.New("project is nil") // ErrFileTooLarge is returned when a file exceeds size limits. ErrFileTooLarge = errors.New("file too large") // ErrInvalidDependencyFormat is returned when a dependency string has invalid format. ErrInvalidDependencyFormat = errors.New("invalid dependencies format") // ErrInvalidPropertyFormat is returned when a property string has invalid format. ErrInvalidPropertyFormat = errors.New("invalid properties format") )
Functions ¶
Types ¶
type Maven ¶
type Maven struct{}
Maven implements the BuildTool interface for Maven projects.
func (*Maven) GetAnalyzer ¶
GetAnalyzer returns the Maven analyzer.
func (*Maven) GetManifestFiles ¶
GetManifestFiles returns Maven manifest files.
type MavenAnalyzer ¶
type MavenAnalyzer struct{}
MavenAnalyzer implements the Analyzer interface for Maven projects. Ported from pombump/pkg/analyzer.go.
func (*MavenAnalyzer) Analyze ¶
func (ma *MavenAnalyzer) Analyze(ctx context.Context, projectPath string) (*analyzer.AnalysisResult, error)
Analyze performs dependency analysis on a Maven project.
func (*MavenAnalyzer) AnalyzeRemote ¶
func (ma *MavenAnalyzer) AnalyzeRemote(ctx context.Context, files map[string][]byte) (*analyzer.RemoteAnalysisResult, error)
AnalyzeRemote performs dependency analysis on remotely-fetched Maven files. Not yet implemented for Maven - returns error. TODO: Implement this function and use ctx for logging and files for analysis.
func (*MavenAnalyzer) RecommendStrategy ¶
func (ma *MavenAnalyzer) RecommendStrategy(ctx context.Context, analysis *analyzer.AnalysisResult, deps []analyzer.Dependency) (*analyzer.Strategy, error)
RecommendStrategy suggests whether to use properties or direct patches.
type Patch ¶
type Patch struct {
GroupID string `json:"groupId" yaml:"groupId"`
ArtifactID string `json:"artifactId" yaml:"artifactId"`
Version string `json:"version" yaml:"version"`
Scope string `json:"scope,omitempty" yaml:"scope,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
}
Patch represents a Maven dependency patch. Ported from pombump/pkg/patch.go.
type PatchList ¶
type PatchList struct {
Patches []Patch `json:"patches" yaml:"patches"`
}
PatchList represents a list of patches from a YAML file.
type PropertyList ¶
type PropertyList struct {
Properties []PropertyPatch `json:"properties" yaml:"properties"`
}
PropertyList represents a list of property patches from a YAML file.
type PropertyPatch ¶
type PropertyPatch struct {
Property string `json:"property" yaml:"property"`
Value string `json:"value" yaml:"value"`
}
PropertyPatch represents a property override.