org.ops4j.pax.construct.util
Interface PomUtils.Pom

All Known Implementing Classes:
XppPom
Enclosing class:
PomUtils

public static interface PomUtils.Pom

API for editing Maven project files


Method Summary
 void addDependency(org.apache.maven.model.Dependency dependency, boolean overwrite)
           
 void addExclusion(java.lang.String groupId, java.lang.String artifactId, boolean overwrite)
           
 void addModule(java.lang.String module, boolean overwrite)
           
 void addRepository(org.apache.maven.model.Repository repository, boolean snapshots, boolean releases, boolean overwrite, boolean pluginRepo)
           
 java.lang.String getArtifactId()
           
 java.io.File getBasedir()
           
 java.lang.String getBundleSymbolicName()
           
 PomUtils.Pom getContainingPom()
           
 java.io.File getFile()
           
 java.lang.String getGroupId()
           
 java.lang.String getId()
           
 java.util.List getModuleNames()
           
 PomUtils.Pom getModulePom(java.lang.String module)
           
 java.lang.String getPackaging()
           
 java.lang.String getParentId()
           
 java.util.Properties getProperties()
           
 java.lang.String getVersion()
           
 boolean isBundleProject()
           
 void mergeSection(PomUtils.Pom pom, java.lang.String fromSection, java.lang.String toSection, boolean append)
          Merge a section of XML from another Maven project POM
 void overlayDetails(PomUtils.Pom pom)
          Overlay POM template with detail from another Maven project POM
 boolean removeDependency(org.apache.maven.model.Dependency dependency)
           
 boolean removeExclusion(java.lang.String groupId, java.lang.String artifactId)
           
 boolean removeModule(java.lang.String module)
           
 void setGroupId(java.lang.String newGroupId)
           
 void setParent(org.apache.maven.project.MavenProject project, java.lang.String relativePath, boolean overwrite)
           
 void setParent(PomUtils.Pom pom, java.lang.String relativePath, boolean overwrite)
           
 void setProperty(java.lang.String key, java.lang.String value)
           
 void setVersion(java.lang.String newVersion)
           
 boolean updateDependencyGroup(org.apache.maven.model.Dependency dependency, java.lang.String newGroupId)
           
 boolean updatePluginVersion(java.lang.String groupId, java.lang.String artifactId, java.lang.String newVersion)
           
 void write()
           
 

Method Detail

getId

java.lang.String getId()
Returns:
unique project identifier

getParentId

java.lang.String getParentId()
Returns:
parents' unique project identifier

getGroupId

java.lang.String getGroupId()
Returns:
project group id

getArtifactId

java.lang.String getArtifactId()
Returns:
project artifact id

getVersion

java.lang.String getVersion()
Returns:
project version

getPackaging

java.lang.String getPackaging()
Returns:
project packaging

getModuleNames

java.util.List getModuleNames()
Returns:
names of modules contained in this project

getContainingPom

PomUtils.Pom getContainingPom()
Returns:
the physical parent project

getModulePom

PomUtils.Pom getModulePom(java.lang.String module)
Parameters:
module - name of a module in this project
Returns:
the module POM, null if it doesn't exist

getFile

java.io.File getFile()
Returns:
the underlying Maven POM file

getBasedir

java.io.File getBasedir()
Returns:
the directory containing this Maven project

isBundleProject

boolean isBundleProject()
Returns:
true if this is an OSGi bundle project, otherwise false

getBundleSymbolicName

java.lang.String getBundleSymbolicName()
Returns:
the symbolic name for this project, null if it doesn't define one

setParent

void setParent(PomUtils.Pom pom,
               java.lang.String relativePath,
               boolean overwrite)
               throws PomUtils.ExistingElementException
Parameters:
pom - the new logical parent project
relativePath - the relative path from this POM to its new parent
overwrite - overwrite element if true, otherwise throw PomUtils.ExistingElementException
Throws:
PomUtils.ExistingElementException

setParent

void setParent(org.apache.maven.project.MavenProject project,
               java.lang.String relativePath,
               boolean overwrite)
               throws PomUtils.ExistingElementException
Parameters:
project - the new logical parent project
relativePath - the relative path from this POM to the parent
overwrite - overwrite element if true, otherwise throw PomUtils.ExistingElementException
Throws:
PomUtils.ExistingElementException

setGroupId

void setGroupId(java.lang.String newGroupId)
Parameters:
newGroupId - the new project group id

setVersion

void setVersion(java.lang.String newVersion)
Parameters:
newVersion - the new project version

addRepository

void addRepository(org.apache.maven.model.Repository repository,
                   boolean snapshots,
                   boolean releases,
                   boolean overwrite,
                   boolean pluginRepo)
                   throws PomUtils.ExistingElementException
Parameters:
repository - a Maven repository
snapshots - enable snapshots for this repository
releases - enable releases for this repository
overwrite - overwrite element if true, otherwise throw PomUtils.ExistingElementException
pluginRepo - treat as plugin repository if true, otherwise assume normal repository
Throws:
PomUtils.ExistingElementException

addModule

void addModule(java.lang.String module,
               boolean overwrite)
               throws PomUtils.ExistingElementException
Parameters:
module - module name
overwrite - overwrite element if true, otherwise throw PomUtils.ExistingElementException
Throws:
PomUtils.ExistingElementException

removeModule

boolean removeModule(java.lang.String module)
Parameters:
module - module name
Returns:
true if module was removed from the project, otherwise false

addDependency

void addDependency(org.apache.maven.model.Dependency dependency,
                   boolean overwrite)
                   throws PomUtils.ExistingElementException
Parameters:
dependency - project dependency
overwrite - overwrite element if true, otherwise throw PomUtils.ExistingElementException
Throws:
PomUtils.ExistingElementException

updateDependencyGroup

boolean updateDependencyGroup(org.apache.maven.model.Dependency dependency,
                              java.lang.String newGroupId)
Parameters:
dependency - project dependency
newGroupId - updated dependency group id
Returns:
true if the dependency was updated

removeDependency

boolean removeDependency(org.apache.maven.model.Dependency dependency)
Parameters:
dependency - project dependency
Returns:
true if dependency was removed from the project, otherwise false

addExclusion

void addExclusion(java.lang.String groupId,
                  java.lang.String artifactId,
                  boolean overwrite)
                  throws PomUtils.ExistingElementException
Parameters:
groupId - dependency exclusion group id
artifactId - dependency exclusion artifact id
overwrite - overwrite element if true, otherwise throw PomUtils.ExistingElementException
Throws:
PomUtils.ExistingElementException

removeExclusion

boolean removeExclusion(java.lang.String groupId,
                        java.lang.String artifactId)
Parameters:
groupId - dependency exclusion group id
artifactId - dependency exclusion artifact id
Returns:
true if dependency exclusion was removed from the project, otherwise false

getProperties

java.util.Properties getProperties()
Returns:
properties defined by the current project

setProperty

void setProperty(java.lang.String key,
                 java.lang.String value)
Parameters:
key - property key
value - property value

updatePluginVersion

boolean updatePluginVersion(java.lang.String groupId,
                            java.lang.String artifactId,
                            java.lang.String newVersion)
Parameters:
groupId - plugin group id
artifactId - plugin artifact id
newVersion - new plugin version
Returns:
true if the plugin was updated

mergeSection

void mergeSection(PomUtils.Pom pom,
                  java.lang.String fromSection,
                  java.lang.String toSection,
                  boolean append)
Merge a section of XML from another Maven project POM

Parameters:
pom - another Maven project
fromSection - path to XML section to merge from
toSection - path to XML section to merge into
append - when true, append instead of merging

overlayDetails

void overlayDetails(PomUtils.Pom pom)
Overlay POM template with detail from another Maven project POM

Parameters:
pom - another Maven project

write

void write()
           throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2007-2008 OPS4J. All Rights Reserved.