maven

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: Apache-2.0 Imports: 19 Imported by: 10

Documentation

Index

Constants

View Source
const (
	TRACE = "TRACE"
	DEBUG = "DEBUG"
	INFO  = "INFO"
	WARN  = "WARN"
	ERROR = "ERROR"
	FATAL = "FATAL"
)

Variables

View Source
var DefaultMavenRepositories = "https://repo.maven.apache.org/maven2@id=central"

DefaultMavenRepositories is a comma separated list of default maven repositories This variable can be overridden at build time

View Source
var Log = log.WithName("maven")

Functions

func NewRepository

func NewRepository(repo string) v1.Repository

NewRepository parses the given repository URL and generates the corresponding v1.Repository.

The repository can be customized by appending @param to the repository URL, e.g.:

http://my-nexus:8081/repository/publicc@id=my-repo@snapshots

That enables snapshots and sets the repository id to `my-repo`

func SettingsConfigMap added in v1.4.0

func SettingsConfigMap(namespace string, name string, settings Settings) (*corev1.ConfigMap, error)

Types

type Activation

type Activation struct {
	ActiveByDefault bool                `xml:"activeByDefault"`
	Property        *PropertyActivation `xml:"property,omitempty"`
}

type Build

type Build struct {
	DefaultGoal string             `xml:"defaultGoal,omitempty"`
	Plugins     []Plugin           `xml:"plugins>plugin,omitempty"`
	Extensions  []v1.MavenArtifact `xml:"extensions>extension,omitempty"`
}

type Command added in v1.5.0

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

func (*Command) Do added in v1.5.0

func (c *Command) Do(ctx context.Context) error

type Context

type Context struct {
	Path string
	// Project             Project
	ExtraMavenOpts      []string
	SettingsContent     []byte
	AdditionalArguments []string
	AdditionalEntries   map[string]interface{}
	// Timeout             time.Duration
	LocalRepository string
}

func NewContext

func NewContext(buildDir string) Context

func (*Context) AddArgument

func (c *Context) AddArgument(argument string)

func (*Context) AddArgumentf

func (c *Context) AddArgumentf(format string, args ...interface{})

func (*Context) AddArguments

func (c *Context) AddArguments(arguments ...string)

func (*Context) AddEntry

func (c *Context) AddEntry(id string, entry interface{})

func (*Context) AddSystemProperty

func (c *Context) AddSystemProperty(name string, value string)

type Dependency

type Dependency struct {
	GroupID    string       `xml:"groupId" yaml:"groupId"`
	ArtifactID string       `xml:"artifactId" yaml:"artifactId"`
	Version    string       `xml:"version,omitempty" yaml:"version,omitempty"`
	Type       string       `xml:"type,omitempty" yaml:"type,omitempty"`
	Classifier string       `xml:"classifier,omitempty" yaml:"classifier,omitempty"`
	Scope      string       `xml:"scope,omitempty" yaml:"scope,omitempty"`
	Exclusions *[]Exclusion `xml:"exclusions>exclusion,omitempty" yaml:"exclusions,omitempty"`
}

Dependency models a dependency

func NewDependency

func NewDependency(groupID string, artifactID string, version string) Dependency

NewDependency creates an new dependency from the given GAV

func ParseGAV

func ParseGAV(gav string) (Dependency, error)

ParseGAV decodes the provided Maven GAV into the corresponding Dependency.

The artifact id is in the form of:

<groupId>:<artifactId>[:<packagingType>[:<classifier>]]:(<version>|'?')

type DependencyManagement

type DependencyManagement struct {
	Dependencies []Dependency `xml:"dependencies>dependency,omitempty"`
}

DependencyManagement models dependency management

type Exclusion

type Exclusion struct {
	GroupID    string `xml:"groupId" yaml:"groupId"`
	ArtifactID string `xml:"artifactId" yaml:"artifactId"`
}

Exclusion models a dependency exclusion

type Execution

type Execution struct {
	ID    string   `xml:"id,omitempty"`
	Phase string   `xml:"phase,omitempty"`
	Goals []string `xml:"goals>goal,omitempty"`
}

type Mirror added in v1.4.0

type Mirror struct {
	ID       string `xml:"id"`
	Name     string `xml:"name,omitempty"`
	URL      string `xml:"url"`
	MirrorOf string `xml:"mirrorOf"`
}

func NewMirror added in v1.4.0

func NewMirror(repo string) Mirror

type Plugin

type Plugin struct {
	GroupID      string       `xml:"groupId"`
	ArtifactID   string       `xml:"artifactId"`
	Version      string       `xml:"version,omitempty"`
	Executions   []Execution  `xml:"executions>execution,omitempty"`
	Dependencies []Dependency `xml:"dependencies>dependency,omitempty"`
}

type Profile

type Profile struct {
	ID                 string          `xml:"id"`
	Activation         Activation      `xml:"activation,omitempty"`
	Properties         Properties      `xml:"properties,omitempty"`
	Repositories       []v1.Repository `xml:"repositories>repository,omitempty"`
	PluginRepositories []v1.Repository `xml:"pluginRepositories>pluginRepository,omitempty"`
}

type Project

type Project struct {
	XMLName              xml.Name
	XMLNs                string                `xml:"xmlns,attr"`
	XMLNsXsi             string                `xml:"xmlns:xsi,attr"`
	XsiSchemaLocation    string                `xml:"xsi:schemaLocation,attr"`
	ModelVersion         string                `xml:"modelVersion"`
	GroupID              string                `xml:"groupId"`
	ArtifactID           string                `xml:"artifactId"`
	Version              string                `xml:"version"`
	Properties           Properties            `xml:"properties,omitempty"`
	DependencyManagement *DependencyManagement `xml:"dependencyManagement"`
	Dependencies         []Dependency          `xml:"dependencies>dependency,omitempty"`
	Repositories         []v1.Repository       `xml:"repositories>repository,omitempty"`
	PluginRepositories   []v1.Repository       `xml:"pluginRepositories>pluginRepository,omitempty"`
	Build                *Build                `xml:"build,omitempty"`
}

Project models a Maven project

func NewProject

func NewProject() Project

func NewProjectWithGAV

func NewProjectWithGAV(group string, artifact string, version string) Project

func (*Project) AddDependencies

func (p *Project) AddDependencies(deps ...Dependency)

AddDependencies adds dependencies to maven's dependencies

func (*Project) AddDependency

func (p *Project) AddDependency(dep Dependency)

AddDependency adds a dependency to maven's dependencies

func (*Project) AddDependencyExclusion

func (p *Project) AddDependencyExclusion(dep Dependency, exclusion Exclusion)

func (*Project) AddDependencyExclusions

func (p *Project) AddDependencyExclusions(dep Dependency, exclusions ...Exclusion)

func (*Project) AddDependencyGAV

func (p *Project) AddDependencyGAV(groupID string, artifactID string, version string)

AddDependencyGAV a dependency to maven's dependencies

func (*Project) AddEncodedDependencyGAV

func (p *Project) AddEncodedDependencyGAV(gav string)

AddEncodedDependencyGAV a dependency to maven's dependencies

func (Project) Command added in v1.5.0

func (p Project) Command(context Context) *Command

func (*Project) LookupDependency

func (p *Project) LookupDependency(dep Dependency) *Dependency

func (Project) MarshalBytes

func (p Project) MarshalBytes() ([]byte, error)

func (*Project) ReplaceDependency

func (p *Project) ReplaceDependency(dep Dependency)

type Properties

type Properties map[string]string

func (Properties) AddAll

func (m Properties) AddAll(properties map[string]string)

func (Properties) MarshalXML

func (m Properties) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PropertyActivation

type PropertyActivation struct {
	Name  string `xml:"name"`
	Value string `xml:"value"`
}

type Settings

type Settings struct {
	XMLName           xml.Name
	XMLNs             string    `xml:"xmlns,attr"`
	XMLNsXsi          string    `xml:"xmlns:xsi,attr"`
	XsiSchemaLocation string    `xml:"xsi:schemaLocation,attr"`
	LocalRepository   string    `xml:"localRepository"`
	Profiles          []Profile `xml:"profiles>profile,omitempty"`
	Mirrors           []Mirror  `xml:"mirrors>mirror,omitempty"`
}

Settings models a Maven settings

func NewDefaultSettings

func NewDefaultSettings(repositories []v1.Repository, mirrors []Mirror) Settings

func NewSettings

func NewSettings() Settings

func (Settings) MarshalBytes

func (s Settings) MarshalBytes() ([]byte, error)

Jump to

Keyboard shortcuts

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