maven

package
v0.0.0-...-ded4385 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

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 GenerateProjectStructure

func GenerateProjectStructure(context Context) error

func NormalizeLog

func NormalizeLog(mavenLog MavenLog)

func Run

func Run(ctx Context) error

func SettingsConfigMap

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

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
	ExtraMavenOpts      []string
	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 MavenLog

type MavenLog struct {
	Level            string `json:"level"`
	Ts               string `json:"ts"`
	Logger           string `json:"logger"`
	Msg              string `json:"msg"`
	Class            string `json:"class"`
	CallerMethodName string `json:"caller_method_name"`
	CallerFileName   string `json:"caller_file_name"`
	CallerLineNumber int    `json:"caller_line_number"`
	Thread           string `json:"thread"`
}

func ParseLog

func ParseLog(line string) (mavenLog MavenLog, error error)

type Mirror

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

Mirror --

func NewMirror

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

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

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

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"`
	Mirrors           []Mirror  `xml:"mirrors>mirror,omitempty"`
}

Settings represent a maven settings

func NewDefaultSettings

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

func NewSettings

func NewSettings() Settings

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