maven

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 18 Imported by: 3 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

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")

Log --

Functions

func CreateSettingsConfigMap

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

CreateSettingsConfigMap --

func GenerateProjectStructure

func GenerateProjectStructure(context Context) error

GenerateProjectStructure --

func Run

func Run(ctx Context) error

Run --

Types

type Activation

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

Activation --

type Build

type Build struct {
	DefaultGoal string   `xml:"defaultGoal,omitempty"`
	Plugins     []Plugin `xml:"plugins>plugin,omitempty"`
}

Build --

type Context

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

Context --

func NewContext

func NewContext(buildDir string, project Project) Context

NewContext --

func (*Context) AddArgument

func (c *Context) AddArgument(argument string)

AddArgument --

func (*Context) AddArgumentf

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

AddArgumentf --

func (*Context) AddArguments

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

AddArguments --

func (*Context) AddEntry

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

AddEntry --

func (*Context) AddSystemProperty

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

AddSystemProperty --

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 represent a maven's dependency

func NewDependency

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

NewDependency create an new dependency from the given gav info

func ParseGAV

func ParseGAV(gav string) (Dependency, error)

ParseGAV decode a maven artifact id to a dependency definition.

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 represent maven's dependency management block

type Exclusion

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

Exclusion represent a maven's dependency exlucsion

type Execution

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

Execution --

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"`
}

Plugin --

type Profile

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

Profile --

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         []Repository          `xml:"repositories>repository,omitempty"`
	PluginRepositories   []Repository          `xml:"pluginRepositories>pluginRepository,omitempty"`
	Build                *Build                `xml:"build,omitempty"`
}

Project represent a maven project

func NewProject

func NewProject() Project

NewProject --

func NewProjectWithGAV

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

NewProjectWithGAV --

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)

AddDependencyExclusion --

func (*Project) AddDependencyExclusions

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

AddDependencyExclusions --

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) LookupDependency

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

LookupDependency --

func (Project) MarshalBytes

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

MarshalBytes --

func (*Project) ReplaceDependency

func (p *Project) ReplaceDependency(dep Dependency)

ReplaceDependency --

type Properties

type Properties map[string]string

Properties --

func (Properties) AddAll

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

AddAll --

func (Properties) MarshalXML

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

MarshalXML --

type PropertyActivation

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

PropertyActivation --

type Repository

type Repository struct {
	ID        string           `xml:"id"`
	Name      string           `xml:"name,omitempty"`
	URL       string           `xml:"url"`
	Snapshots RepositoryPolicy `xml:"snapshots,omitempty"`
	Releases  RepositoryPolicy `xml:"releases,omitempty"`
}

Repository --

func NewRepository

func NewRepository(repo string) Repository

NewRepository parse the given repo url ang generated the related struct.

The repository can be customized by appending @instruction to the repository uri, as example:

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

Will enable snapshots and sets the repo it to my-repo

type RepositoryPolicy

type RepositoryPolicy struct {
	Enabled        bool   `xml:"enabled"`
	UpdatePolicy   string `xml:"updatePolicy,omitempty"`
	ChecksumPolicy string `xml:"checksumPolicy,omitempty"`
}

RepositoryPolicy --

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"`
}

Settings represent a maven settings

func NewDefaultSettings

func NewDefaultSettings(repositories []Repository) Settings

NewDefaultSettings --

func NewSettings

func NewSettings() Settings

NewSettings --

func (Settings) MarshalBytes

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

MarshalBytes --

Jump to

Keyboard shortcuts

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