maven

package
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: MPL-2.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDependencyTree

func ParseDependencyTree(stdin string) (graph.Deps, error)

func PomFileGraph added in v0.7.33

func PomFileGraph(target, dir string) (graph.Deps, error)

PomFileGraph returns simply the list of dependencies listed within the manifest file.

Types

type Dependency

type Dependency struct {
	GroupId    string `xml:"groupId"`
	ArtifactId string `xml:"artifactId"`
	Version    string `xml:"version"`

	// Scope is where the dependency is used, such as "test" or "runtime".
	Scope string `xml:"scope"`

	Failed bool
}

func ReadDependencyTree

func ReadDependencyTree(lines []string, parser LineParser) ([]Dependency, map[Dependency][]Dependency, error)

func (Dependency) ID added in v0.7.27

func (d Dependency) ID() string

ID returns the dependency identifier as groupId:artifactId.

type LineParser

type LineParser func(line string) (level int, node Dependency, err error)

level is 1-indexed

type Manifest

type Manifest struct {
	Project              xml.Name     `xml:"project"`
	Parent               Parent       `xml:"parent"`
	Modules              []string     `xml:"modules>module"`
	ArtifactID           string       `xml:"artifactId"`
	GroupID              string       `xml:"groupId"`
	Version              string       `xml:"version"`
	Description          string       `xml:"description"`
	Name                 string       `xml:"name"`
	URL                  string       `xml:"url"`
	Dependencies         []Dependency `xml:"dependencies>dependency"`
	DependencyManagement []Dependency `xml:"dependencyManagement>dependencies>dependency"`
}

A Manifest represents a POM manifest file.

func ResolveManifestFromTarget added in v0.7.33

func ResolveManifestFromTarget(target, dir string) (*Manifest, error)

ResolveManifestFromTarget tries to determine what target is supposed to be and then reads the POM manifest file pointed to by target if it is a path to such a file or module.

type Maven

type Maven struct {
	Cmd string
}

func (*Maven) Clean

func (m *Maven) Clean(dir string) error

func (*Maven) Compile

func (m *Maven) Compile(dir string) error

func (*Maven) DependencyList

func (m *Maven) DependencyList(dir, buildTarget string) (string, error)

DependencyList runs Maven's dependency:list goal for the specified project.

func (*Maven) DependencyTree

func (m *Maven) DependencyTree(dir, buildTarget string) (graph.Deps, error)

DependencyTree runs Maven's dependency:tree goal for the specified project.

type MvnModule added in v0.7.27

type MvnModule struct {
	// Name is taken from the module's POM file.
	Name string

	// Target is the relative path from the root of the FOSSA project to the module's manifest file or to
	// the directory containing the module's "pom.xml". The target may name a file other than "pom.xml" and
	// it may even be the groupId:artifactId string identifying the "Maven project".
	Target string

	// Dir is the relative path from the root of the FOSSA project to either the module or to a parent module
	// under which this one is listed. This is where `mvn` should be run to get the dependency tree.
	Dir string
}

A MvnModule can identify a Maven project with the target path.

func Modules

func Modules(pomFilePath string, reactorDir string, checked map[string]bool) ([]MvnModule, error)

Modules returns a list of all Maven modules at the directory of pomFilePath and below.

type Parent

type Parent struct {
	ArtifactID string `xml:"artifactId"`
	GroupID    string `xml:"groupId"`
	Version    string `xml:"version"`
}

Jump to

Keyboard shortcuts

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