public class Pom extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ROOT_MODULE_SYMBOL |
| Constructor and Description |
|---|
Pom(String groupId,
String artifactId,
String version,
String packaging,
Collection<? extends Dependency> dependenciesInDependencyManagement,
Collection<? extends Dependency> dependencies,
Parent parent,
Collection<? extends Module> modules,
Collection<? extends Property> pomProperties,
String name,
Collection<? extends Repository> repositories,
Collection<? extends Repository> pluginRepositories,
String sourceDirectory,
String testSourceDirectory,
Collection<? extends Filter> filters,
Collection<? extends Plugin> pluginsInPluginManagement,
Collection<? extends Plugin> buildPlugins,
Collection<? extends Resource> resources,
String path,
String moduleName,
Collection<Path> paths)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
Dependency |
asDependency(DependencyScope scope)
Returns this module as a Dependency with the given scope
|
Dependency |
asDependency(DependencyScope scope,
DependencyType type)
Returns this module as a Dependency with the given scope and type
|
boolean |
canAddDependency(Dependency newDependency,
boolean checkVersion)
Indicates whether it's valid to add the given
Dependency to this
POM. |
boolean |
canAddDependencyToDependencyManagement(Dependency newDependency,
boolean checkVersion)
Indicates whether it's valid to add the given
Dependency to the dependencyManagement
of this pom |
boolean |
canAddPluginToPluginManagement(Plugin newPlugin,
boolean checkVersion)
Indicates whether it's valid to add the given
Plugin to the pluginManagement
of this pom |
String |
getArtifactId()
Returns the ID of the artifact created by this module or project
|
Set<Plugin> |
getBuildPlugins()
Returns any registered build plugins
|
Set<Plugin> |
getBuildPluginsExcludingVersion(Plugin plugin)
Returns any build plugins with the same groupId and artifactId as the
given plugin.
|
Set<Dependency> |
getDependencies() |
Set<Dependency> |
getDependenciesExcludingVersion(Dependency dependency)
Locates any dependencies which match the presented dependency, excluding
the version number.
|
String |
getDisplayName()
Returns the display name of this module of the user project
|
Set<Filter> |
getFilters() |
String |
getGroupId()
Returns the ID of the organisation or group that owns this module or
project
|
String |
getModuleName()
Returns the programmatic name of this module of the user project
|
Set<Module> |
getModules() |
String |
getName()
Deprecated.
use
getDisplayName() instead |
String |
getPackaging() |
Parent |
getParent() |
String |
getPath()
Returns this descriptor's canonical path on the file system
|
String |
getPathLocation(Path path)
Returns the canonical path of the given
Path within this module,
plus a trailing separator if found |
PhysicalPath |
getPhysicalPath(Path path)
Returns the
PhysicalPath for the given Path of this
module |
List<PhysicalPath> |
getPhysicalPaths() |
Set<Repository> |
getPluginRepositories() |
Set<Property> |
getPomProperties() |
Set<Property> |
getPropertiesExcludingValue(Property property)
Locates any properties which match the presented property, excluding the
value.
|
Property |
getProperty(String name)
Locates the first occurrence of a property for a given name and returns
it.
|
Set<Repository> |
getRepositories() |
Set<Resource> |
getResources() |
String |
getRoot()
Returns the canonical path of this module's root directory, plus a
trailing separator
|
String |
getSourceDirectory() |
String |
getTestSourceDirectory() |
String |
getVersion()
Returns the version number of this module or project
|
boolean |
hasDependencyExcludingVersion(Dependency dependency)
Indicates whether this
Pom has the given Dependency,
ignoring the version number. |
boolean |
isAllDependenciesRegistered(Collection<? extends Dependency> dependencies)
Indicates whether all of the given dependencies are registered, by
calling
#isDependencyRegistered(Dependency) for each one,
ignoring any null elements. |
boolean |
isAllPluginRepositoriesRegistered(Collection<? extends Repository> repositories)
Indicates whether all the given plugin repositories are registered, by
calling
isPluginRepositoryRegistered(Repository) for each one,
ignoring any null elements. |
boolean |
isAllPluginsRegistered(Collection<? extends Plugin> plugins)
Indicates whether all of the given plugins are registered, based on their
groupId, artifactId, and version.
|
boolean |
isAllRepositoriesRegistered(Collection<? extends Repository> repositories)
Indicates whether all the given repositories are registered.
|
boolean |
isAnyDependenciesRegistered(Collection<? extends Dependency> dependencies)
Indicates whether any of the given dependencies are registered, by
calling
#isDependencyRegistered(Dependency) for each one. |
boolean |
isAnyPluginsRegistered(Collection<? extends Plugin> plugins)
Indicates whether any of the given plugins are registered, by calling
isBuildPluginRegistered(Plugin) for each one. |
boolean |
isBuildPluginRegistered(Plugin plugin)
Deprecated.
use
isPluginRegistered(GAV) instead |
boolean |
isDependencyRegistered(Dependency dependency,
boolean checkVersion)
Indicates whether the given dependency is registered without checking dependency version
, by checking the result of
Dependency.equals(Object). |
boolean |
isDependencyRegisteredInDependencyManagement(Dependency dependency,
boolean checkVersion)
Indicates whether the given dependency is registered in dependencyManagement without checking dependency version
, by checking the result of
Dependency.equals(Object). |
boolean |
isFilterRegistered(Filter filter)
Indicates whether the given filter is registered.
|
boolean |
isPluginRegistered(GAV gav)
Indicates whether a plugin with the given coordinates is registered
|
boolean |
isPluginRegisteredInPluginManagement(Plugin plugin,
boolean checkVersion)
Indicates whether the given plugin is registered in pluginManagement without checking plugin version
, by checking the result of
Plugin.equals(Object). |
boolean |
isPluginRepositoryRegistered(Repository repository)
Indicates whether the given plugin repository is registered.
|
boolean |
isPropertyRegistered(Property property)
Indicates whether the given build property is registered.
|
boolean |
isRepositoryRegistered(Repository repository)
Indicates whether the given repository is registered.
|
boolean |
isResourceRegistered(Resource resource)
Indicates whether the given resource is registered.
|
String |
toString() |
public static final String ROOT_MODULE_SYMBOL
public Pom(String groupId, String artifactId, String version, String packaging, Collection<? extends Dependency> dependenciesInDependencyManagement, Collection<? extends Dependency> dependencies, Parent parent, Collection<? extends Module> modules, Collection<? extends Property> pomProperties, String name, Collection<? extends Repository> repositories, Collection<? extends Repository> pluginRepositories, String sourceDirectory, String testSourceDirectory, Collection<? extends Filter> filters, Collection<? extends Plugin> pluginsInPluginManagement, Collection<? extends Plugin> buildPlugins, Collection<? extends Resource> resources, String path, String moduleName, Collection<Path> paths)
groupId - the Maven groupId, explicit or inherited (required)artifactId - the Maven artifactId (required)version - the version of the artifact being built (required)packaging - the Maven packaging (required)dependenciesInDependencyManagement - (can be null for none)dependencies - (can be null for none)parent - the POM's parent declaration (can be null for
none)modules - the modules defined by this POM (only applies when
packaging is "pom"; can be null for none)pomProperties - any properties defined in the POM (can be
null for none)name - the Maven name of the artifact being built (can be blank)repositories - any repositories defined in the POM (can be
null for none)pluginRepositories - any plugin repositories defined in the POM (can
be null for none)sourceDirectory - the directory relative to the POM that contains
production code (can be blank for the Maven default)testSourceDirectory - the directory relative to the POM that
contains test code (can be blank for the Maven default)filters - any filters defined in the POM (can be null
for none)pluginsInPluginManagement - any plugin defined in pluginManagement sectionbuildPlugins - any plugins defined in the POM (can be
null for none)resources - any build resources defined in the POM (can be
null for none)path - the canonical path of this POM (required)moduleName - the Maven name of this module (blank for the project's
root or only POM)paths - the Paths required for this module, in addition to
the root (can be null)public Dependency asDependency(DependencyScope scope)
scope - the DependencyScope to usenull instancepublic Dependency asDependency(DependencyScope scope, DependencyType type)
scope - the DependencyScope to usetype - the DependencyType to usenull instancepublic boolean canAddDependency(Dependency newDependency, boolean checkVersion)
Dependency to this
POM.newDependency - the Dependency to check (can be
null)public boolean canAddDependencyToDependencyManagement(Dependency newDependency, boolean checkVersion)
Dependency to the dependencyManagement
of this pomnewDependency - the Dependency to check (can be
null)public boolean canAddPluginToPluginManagement(Plugin newPlugin, boolean checkVersion)
Plugin to the pluginManagement
of this pomnewPlugin - the Plugin to check (can be
null)public String getArtifactId()
public Set<Plugin> getBuildPlugins()
null collectionpublic Set<Plugin> getBuildPluginsExcludingVersion(Plugin plugin)
plugin - to locate (required; note the version number is ignored in
comparisons)Set)public Set<Dependency> getDependencies()
public Set<Dependency> getDependenciesExcludingVersion(Dependency dependency)
dependency - to locate (can be null)Set)public String getDisplayName()
public String getGroupId()
public String getModuleName()
@Deprecated public String getName()
getDisplayName() insteadpublic String getPackaging()
public Parent getParent()
public String getPath()
public String getPathLocation(Path path)
Path within this module,
plus a trailing separator if foundpath - the path for which to get the canonical location (required)null if this module has no such pathpublic PhysicalPath getPhysicalPath(Path path)
PhysicalPath for the given Path of this
modulepath - the sub-path for which to return the PhysicalPathnull if this module has no such sub-pathpublic List<PhysicalPath> getPhysicalPaths()
public Set<Repository> getPluginRepositories()
public Set<Property> getPropertiesExcludingValue(Property property)
property - to locate (required; note the value is ignored in
comparisons)Set)public Property getProperty(String name)
name - the property name (required)public Set<Repository> getRepositories()
public String getRoot()
public String getSourceDirectory()
public String getTestSourceDirectory()
public String getVersion()
public boolean hasDependencyExcludingVersion(Dependency dependency)
Pom has the given Dependency,
ignoring the version number.dependency - the Dependency to check for (can be
null)false if a null dependency is givenpublic boolean isAllDependenciesRegistered(Collection<? extends Dependency> dependencies)
#isDependencyRegistered(Dependency) for each one,
ignoring any null elements.dependencies - the dependencies to check (can be null
or contain null elements)null or empty collection is givenpublic boolean isAllPluginRepositoriesRegistered(Collection<? extends Repository> repositories)
isPluginRepositoryRegistered(Repository) for each one,
ignoring any null elements.repositories - the plugin repositories to check (can be
null)true if a null collection is givenpublic boolean isAllPluginsRegistered(Collection<? extends Plugin> plugins)
plugins - the plugins to check (required)false if any of them are not registeredpublic boolean isAllRepositoriesRegistered(Collection<? extends Repository> repositories)
isRepositoryRegistered(Repository) for each one,
ignoring any null elements.repositories - the repositories to check (can be null)null collection is givenpublic boolean isAnyDependenciesRegistered(Collection<? extends Dependency> dependencies)
#isDependencyRegistered(Dependency) for each one.dependencies - the dependencies to check (can be null)public boolean isAnyPluginsRegistered(Collection<? extends Plugin> plugins)
isBuildPluginRegistered(Plugin) for each one.plugins - the plugins to check (required)@Deprecated public boolean isBuildPluginRegistered(Plugin plugin)
isPluginRegistered(GAV) insteadplugin - to check (required)public boolean isDependencyRegistered(Dependency dependency, boolean checkVersion)
Dependency.equals(Object).dependency - the dependency to check (can be null)false if a null dependency is givenpublic boolean isDependencyRegisteredInDependencyManagement(Dependency dependency, boolean checkVersion)
Dependency.equals(Object).dependency - the dependency to check (can be null)false if a null dependency is givenpublic boolean isPluginRegisteredInPluginManagement(Plugin plugin, boolean checkVersion)
Plugin.equals(Object).plugin - the plugin to check (can be null)false if a null dependency is givenpublic boolean isFilterRegistered(Filter filter)
filter - to check (required)public boolean isPluginRegistered(GAV gav)
coordinates - the coordinates to match upon; can be
nullnull coordinates are givenpublic boolean isPluginRepositoryRegistered(Repository repository)
repository - repository to check (can be null)false if a null repository is givenpublic boolean isPropertyRegistered(Property property)
property - to check (required)public boolean isRepositoryRegistered(Repository repository)
repository - to check (can be null)false if a null repository is givenpublic boolean isResourceRegistered(Resource resource)
resource - to check (required)Copyright © 2009–2017 Pivotal Software, Inc.. All rights reserved.