Documentation
¶
Index ¶
- Constants
- Variables
- func NewRepository(repo string) v1.Repository
- type Activation
- type Build
- type Command
- type Context
- type Dependency
- type DependencyManagement
- type Exclusion
- type Execution
- type Mirror
- type Plugin
- type Profile
- type Project
- func (p *Project) AddDependencies(deps ...Dependency)
- func (p *Project) AddDependency(dep Dependency)
- func (p *Project) AddDependencyExclusion(dep Dependency, exclusion Exclusion)
- func (p *Project) AddDependencyExclusions(dep Dependency, exclusions ...Exclusion)
- func (p *Project) AddDependencyGAV(groupID string, artifactID string, version string)
- func (p *Project) AddEncodedDependencyExclusion(gav string, exclusion Exclusion)
- func (p *Project) AddEncodedDependencyGAV(gav string)
- func (p Project) Command(context Context) *Command
- func (p *Project) LookupDependency(dep Dependency) *Dependency
- func (p Project) MarshalBytes() ([]byte, error)
- func (p *Project) ReplaceDependency(dep Dependency)
- type PropertyActivation
- type Proxy
- type Settings
- type SettingsOption
Constants ¶
const ( TRACE = "TRACE" DEBUG = "DEBUG" INFO = "INFO" WARN = "WARN" ERROR = "ERROR" FATAL = "FATAL" )
Variables ¶
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.
var DefaultRepositories = defaultRepositories{}
var Log = log.WithName("maven")
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 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 (*Context) AddArgument ¶
func (*Context) AddArgumentf ¶
func (*Context) AddArguments ¶
func (*Context) 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 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.Properties `xml:"configuration,omitempty"`
}
type Mirror ¶ added in v1.4.0
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 (*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 ¶
AddDependencyGAV adds a dependency to maven's dependencies.
func (*Project) AddEncodedDependencyExclusion ¶ added in v1.6.0
func (*Project) AddEncodedDependencyGAV ¶
AddEncodedDependencyGAV adds a dependency in GAV format to maven's dependencies.
func (*Project) LookupDependency ¶
func (p *Project) LookupDependency(dep Dependency) *Dependency
func (Project) MarshalBytes ¶
func (*Project) ReplaceDependency ¶
func (p *Project) ReplaceDependency(dep Dependency)
type PropertyActivation ¶
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 ¶
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