maven

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 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 DefaultRepositories = defaultRepositories{}
View Source
var Log = log.WithName("maven")
View Source
var ProxyFromEnvironment = proxyFromEnvironment{}

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`.

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
	ExtraMavenOpts      []string
	GlobalSettings      []byte
	UserSettings        []byte
	SettingsSecurity    []byte
	AdditionalArguments []string
	AdditionalEntries   map[string]interface{}
	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"`
	Configuration v1.PluginProperties `xml:"configuration,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         v1.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           v1.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 adds a dependency to maven's dependencies.

func (*Project) AddEncodedDependencyExclusion added in v1.6.0

func (p *Project) AddEncodedDependencyExclusion(gav string, exclusion Exclusion)

func (*Project) AddEncodedDependencyGAV

func (p *Project) AddEncodedDependencyGAV(gav string)

AddEncodedDependencyGAV adds a dependency in GAV format 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 PropertyActivation

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

type Proxy added in v1.8.0

type Proxy struct {
	ID            string `xml:"id"`
	Active        bool   `xml:"active"`
	Protocol      string `xml:"protocol"`
	Host          string `xml:"host"`
	Port          string `xml:"port,omitempty"`
	Username      string `xml:"username,omitempty"`
	Password      string `xml:"password,omitempty"`
	NonProxyHosts string `xml:"nonProxyHosts,omitempty"`
}

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"`
	Servers           []v1.Server `xml:"servers>server,omitempty"`
	Profiles          []Profile   `xml:"profiles>profile,omitempty"`
	Proxies           []Proxy     `xml:"proxies>proxy,omitempty"`
	Mirrors           []Mirror    `xml:"mirrors>mirror,omitempty"`
}

Settings models a Maven settings.

func NewSettings

func NewSettings(options ...SettingsOption) (Settings, error)

func (Settings) MarshalBytes

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

type SettingsOption added in v1.8.0

type SettingsOption interface {
	// contains filtered or unexported methods
}

func Repositories added in v1.8.0

func Repositories(repositories ...string) SettingsOption

Jump to

Keyboard shortcuts

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