org.apache.maven.project
Class Project

java.lang.Object
  extended byorg.apache.maven.project.Project

public class Project
extends java.lang.Object

Version:
$Id: Project.java 517014 2007-03-11 21:15:50Z ltheussl $
Author:
Jason van Zyl, Vincent Massol, Glenn McAllister
To Do:
Change the file reference for the source POM to an URL.

Constructor Summary
Project()
          Default constructor.
Project(java.io.Reader in)
          Constructor with prebuilt model.
Project(java.lang.String path)
          Constructor with prebuilt model.
Project(java.net.URL url)
          Constructor with prebuilt model.
 
Method Summary
 void addBranch(org.apache.maven.project.Branch branch)
           
 void addContributor(org.apache.maven.project.Contributor contributor)
           
 void addDependency(org.apache.maven.project.Dependency dependency)
          Add a unique dependency for this project.
 void addDeveloper(org.apache.maven.project.Developer developer)
           
 void addLicense(org.apache.maven.project.License license)
           
 void addMailingList(org.apache.maven.project.MailingList mailingList)
           
 void addPackageGroup(org.apache.maven.project.PackageGroup packageGroup)
           
 void addProperty(java.lang.String s, java.lang.String s1)
           
 void addReport(java.lang.String s)
           
 void addVersion(org.apache.maven.project.Version version)
          Add a distribution to this project.
 void buildArtifactList()
          Build the artifact list.
 boolean equals(java.lang.Object o)
           
 java.lang.String getArtifactDirectory()
           
 java.lang.String getArtifactId()
          Get the artifact id.
 java.util.List getArtifacts()
          Get the atrifact attribute.
 java.util.List getBranches()
           
 org.apache.maven.project.Build getBuild()
           
 MavenJellyContext getContext()
          Get the context attribute.
 java.util.List getContributors()
           
 java.lang.String getCurrentVersion()
           
 java.util.List getDependencies()
           
 org.apache.maven.project.Dependency getDependency(java.lang.String depId)
          Get an individual dependency by id.
 java.lang.String getDependencyClasspath()
          Get the dependency classpath.
 java.lang.String getDependencyPath(java.lang.String depId)
          Get an individual dependencies classpath entry.
 DependencyVerifier getDependencyVerifier()
          Get the dependency verifier for this project.
 java.util.Set getDependentProjectIds()
          Get the list of dependent projects ids.
 java.lang.String getDescription()
           
 java.util.List getDevelopers()
           
 java.lang.String getDistributionDirectory()
           
 java.lang.String getDistributionSite()
           
 java.lang.String getExtend()
           
 java.io.File getFile()
          Get the file this POM was derived from
 java.lang.String getGroupId()
           
 java.lang.String getGumpRepositoryId()
           
 java.lang.String getId()
           
 java.lang.String getInceptionYear()
           
 java.lang.String getIssueTrackingUrl()
           
 java.util.List getLicenses()
           
 java.lang.String getLogo()
           
 java.util.List getMailingLists()
           
 java.io.File getMavenXml()
           
 java.lang.String getName()
           
 org.apache.maven.project.Organization getOrganization()
           
 java.lang.String getPackage()
           
 java.util.List getPackageGroups()
           
 Project getParent()
           
 MavenJellyContext getPluginContext(java.lang.String pluginId)
          Deprecated. use the tag instead
 java.lang.String getPomVersion()
           
 java.lang.String getProjectAsString()
          Create an XML string from the project.
 java.util.Properties getProperties()
           
 java.util.List getReports()
           
 org.apache.maven.project.Repository getRepository()
           
 java.lang.String getShortDescription()
           
 java.lang.String getSiteAddress()
           
 java.lang.String getSiteDirectory()
           
 java.lang.String getUrl()
           
 org.apache.maven.project.Version getVersionById(java.lang.String versionId)
          Return a distribution for this project.
 java.util.List getVersions()
           
 int hashCode()
           
 boolean hasMavenXml()
           
 boolean hasParent()
          Determine whether this project has a parent.
 boolean hasRepository()
          Get flag to indicate the presence of a source repository.
 void initialize()
          Initialize the project.
 boolean isPomCurrent()
          Indicate whether the POM is of the latest version.
 java.lang.String legacyToDependencyKey(java.lang.String id)
           
static java.lang.String legacyToStandardId(java.lang.String id)
          This is to support methods that are using the legacy form of the project id.
(package private) static void mergeLists(java.util.List srcList, java.util.List targetList)
           
 void mergeParent(Project parent)
          Setup inheritance from a parent project.
 java.io.File parentBasedir()
          Get the parent's basedir.
 java.io.File parentMavenXml()
          Get parent maven.xml file.
 void popContext()
           
 void pushContext(MavenJellyContext context)
          Push a new context onto the stack.
 void resolveIds()
           
 void setArtifactId(java.lang.String s)
           
 void setArtifacts(java.util.List artifactList)
          Set the artifactList attribute.
 void setBranches(java.util.List list)
           
 void setBuild(org.apache.maven.project.Build build)
           
 void setContext(MavenJellyContext context)
          Set the context attribute.
 void setContributors(java.util.List list)
           
 void setCurrentVersion(java.lang.String s)
           
 void setDependencies(java.util.List list)
           
 void setDependencyPath(java.lang.String depId, java.lang.String path)
          Set an individual dependency's classpath entry.
 void setDependencyVerifier(DependencyVerifier dependencyVerifier)
          Set the dependency verifier.
 void setDescription(java.lang.String s)
           
 void setDevelopers(java.util.List list)
           
 void setDistributionDirectory(java.lang.String s)
           
 void setDistributionSite(java.lang.String s)
           
 void setExtend(java.lang.String s)
           
 void setFile(java.io.File file)
          Set the file that this POM was derived from.
 void setGroupId(java.lang.String s)
           
 void setGumpRepositoryId(java.lang.String s)
           
 void setId(java.lang.String id)
           
 void setInceptionYear(java.lang.String s)
           
 void setIssueTrackingUrl(java.lang.String s)
           
 void setLicenses(java.util.List list)
           
 void setLogo(java.lang.String s)
           
 void setMailingLists(java.util.List list)
           
 void setName(java.lang.String s)
           
 void setOrganization(org.apache.maven.project.Organization organization)
           
 void setPackage(java.lang.String s)
           
 void setPackageGroups(java.util.List list)
           
 void setParent(Project parent)
          Set the project that this one extends
 void setPomVersion(java.lang.String s)
           
 void setProperties(java.util.Properties properties)
           
 void setReports(java.util.List list)
           
 void setRepository(org.apache.maven.project.Repository repository)
           
 void setShortDescription(java.lang.String s)
           
 void setSiteAddress(java.lang.String s)
           
 void setSiteDirectory(java.lang.String s)
           
 void setUrl(java.lang.String s)
           
 void setVersions(java.util.List list)
           
static java.lang.String standardToLegacyId(java.lang.String id)
          This method is to support methods are expecting legacy ids.
 java.lang.String toString()
           
 void verifyDependencies()
          Verify the dependencies for this project.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Project

public Project()
Default constructor.


Project

public Project(java.io.Reader in)
        throws java.lang.Exception
Constructor with prebuilt model.

Parameters:
in - the input reader
Throws:
java.lang.Exception - an error occured reading the file
To Do:
should not have to throw Exception

Project

public Project(java.net.URL url)
        throws java.lang.Exception
Constructor with prebuilt model.

Parameters:
url - the input url
Throws:
java.lang.Exception - an error occured reading the file
To Do:
should not have to throw Exception

Project

public Project(java.lang.String path)
        throws java.lang.Exception
Constructor with prebuilt model.

Parameters:
path - the input path
Throws:
java.lang.Exception - an error occured reading the file
To Do:
should not have to throw Exception
Method Detail

getMavenXml

public java.io.File getMavenXml()
Returns:
the maven.xml file

hasMavenXml

public boolean hasMavenXml()
Returns:
true if the maven.xml file for the project exists

getId

public java.lang.String getId()
Returns:
the id of the project

setId

public void setId(java.lang.String id)

getArtifactId

public java.lang.String getArtifactId()
Get the artifact id.

Returns:
The artifactId

getPluginContext

public MavenJellyContext getPluginContext(java.lang.String pluginId)
                                   throws java.lang.Exception
Deprecated. use the tag instead

Get the plugin context using the plugin name.

Parameters:
pluginId - Plugin name.
Returns:
The plugin context create for the named plugin when it was loaded for this project.
Throws:
UnknownPluginException - if the plugin could not be found
java.lang.Exception
To Do:
[1.0] - when we are caching plugins, this should load on demand, also move to plugin manager

setContext

public void setContext(MavenJellyContext context)
Set the context attribute.

Parameters:
context - the context to use

pushContext

public void pushContext(MavenJellyContext context)
Push a new context onto the stack.

Parameters:
context -

popContext

public void popContext()

getContext

public MavenJellyContext getContext()
Get the context attribute.

Returns:
The

setArtifacts

public void setArtifacts(java.util.List artifactList)
Set the artifactList attribute.

Parameters:
artifactList - list of artifacts for the project

getArtifacts

public java.util.List getArtifacts()
Get the atrifact attribute.

Returns:
The list of artifacts for the project

setFile

public void setFile(java.io.File file)
Set the file that this POM was derived from.

Parameters:
file - POM file

getFile

public java.io.File getFile()
Get the file this POM was derived from

Returns:
POM file

getParent

public Project getParent()
Returns:
the project that this one extends, if any

hasParent

public boolean hasParent()
Determine whether this project has a parent.

Returns:
State of ancestry.

setParent

public void setParent(Project parent)
Set the project that this one extends

Parameters:
parent - the parent project

parentBasedir

public java.io.File parentBasedir()
Get the parent's basedir.

Returns:
Parent's basedir.

parentMavenXml

public java.io.File parentMavenXml()
Get parent maven.xml file.

Returns:
Parent's maven.xml file.

getArtifactDirectory

public java.lang.String getArtifactDirectory()
Returns:
the directory name for this proejct's artifacts

addDependency

public void addDependency(org.apache.maven.project.Dependency dependency)
Add a unique dependency for this project.

Parameters:
dependency - Dependency for this project.

mergeLists

static void mergeLists(java.util.List srcList,
                       java.util.List targetList)
Parameters:
srcList - source list to add items from
targetList - target list to add unique items to
To Do:
eventually, just use sets instead.

getDependentProjectIds

public java.util.Set getDependentProjectIds()
Get the list of dependent projects ids.

Returns:
the set of all dependencies' project ids

setDependencyPath

public void setDependencyPath(java.lang.String depId,
                              java.lang.String path)
Set an individual dependency's classpath entry.

Parameters:
depId - Dependency id.
path - Classpath for the given dependency.

getDependencyPath

public java.lang.String getDependencyPath(java.lang.String depId)
Get an individual dependencies classpath entry.

Parameters:
depId - Dependency id.
Returns:
Classpath for the given dependency.

getDependency

public org.apache.maven.project.Dependency getDependency(java.lang.String depId)
Get an individual dependency by id.

Parameters:
depId - Dependency id.
Returns:
Dependency for the given id.

hasRepository

public boolean hasRepository()
Get flag to indicate the presence of a source repository.

Returns:
true if the project is part of a repository, false otherwise

isPomCurrent

public boolean isPomCurrent()
Indicate whether the POM is of the latest version.

Returns:
true if the pom version is the same as the currently running version of maven specified by MavenConstants, or false otherwise

getVersionById

public org.apache.maven.project.Version getVersionById(java.lang.String versionId)
Return a distribution for this project.

Parameters:
versionId - the id of the version to return
Returns:
List of distributions.

initialize

public void initialize()
                throws java.io.IOException
Initialize the project. This consists of the following stages.

1) Build the Ant project that can be used within plugin.jelly scripts and other Jelly scripts.

2) Build the artifact list.

3) Build the dependency classpath.

4) Create the dependency verifier.

5) Initialize the driver for this project.

Throws:
java.io.IOException - If an error occurs during project initialization.

verifyDependencies

public void verifyDependencies()
                        throws RepoConfigException,
                               UnsatisfiedDependencyException,
                               ChecksumVerificationException
Verify the dependencies for this project.

Throws:
RepoConfigException - If an error occurs checking the local settings.
UnsatisfiedDependencyException - If an error occurs due to missing exceptions.
ChecksumVerificationException - if the downloaded files fail verification

setDependencyVerifier

public void setDependencyVerifier(DependencyVerifier dependencyVerifier)
Set the dependency verifier.

Parameters:
dependencyVerifier - Dependency Verifier.

getDependencyVerifier

public DependencyVerifier getDependencyVerifier()
Get the dependency verifier for this project. We can probably share a dependency verifier.

Returns:
The DependencyVerifier for this project.

getDependencyClasspath

public java.lang.String getDependencyClasspath()
Get the dependency classpath.

Returns:
The dependency classpath.

buildArtifactList

public void buildArtifactList()
Build the artifact list.


legacyToStandardId

public static java.lang.String legacyToStandardId(java.lang.String id)
This is to support methods that are using the legacy form of the project id. Currently the id is : but the following methods assume :

Project::getDependencyPath( ) Project::getDependency( )

We don't want users to have to alter any usage until we have properly deprecated the use of the form.

Parameters:
id - the legacy id to convert
Returns:
the id in standard format

legacyToDependencyKey

public java.lang.String legacyToDependencyKey(java.lang.String id)

standardToLegacyId

public static java.lang.String standardToLegacyId(java.lang.String id)
This method is to support methods are expecting legacy ids. The following methods expect legacy ids.

MavenJellyContext::getMavenJarOverride( ) Project::getArtifactDirectory( )

We don't want users to have to alter any usage until we have properly deprecated the use of the form.

Parameters:
id - the standard id to convert
Returns:
the id in legacy format

mergeParent

public void mergeParent(Project parent)
Setup inheritance from a parent project.

Parameters:
parent - the parent project

addBranch

public void addBranch(org.apache.maven.project.Branch branch)

addContributor

public void addContributor(org.apache.maven.project.Contributor contributor)

addDeveloper

public void addDeveloper(org.apache.maven.project.Developer developer)

addLicense

public void addLicense(org.apache.maven.project.License license)

addMailingList

public void addMailingList(org.apache.maven.project.MailingList mailingList)

addPackageGroup

public void addPackageGroup(org.apache.maven.project.PackageGroup packageGroup)

addProperty

public void addProperty(java.lang.String s,
                        java.lang.String s1)

addReport

public void addReport(java.lang.String s)

getBranches

public java.util.List getBranches()

getBuild

public org.apache.maven.project.Build getBuild()

getContributors

public java.util.List getContributors()

getCurrentVersion

public java.lang.String getCurrentVersion()

getDependencies

public java.util.List getDependencies()

getDescription

public java.lang.String getDescription()

getDevelopers

public java.util.List getDevelopers()

getDistributionDirectory

public java.lang.String getDistributionDirectory()

getDistributionSite

public java.lang.String getDistributionSite()

getExtend

public java.lang.String getExtend()

getGroupId

public java.lang.String getGroupId()

getGumpRepositoryId

public java.lang.String getGumpRepositoryId()

getInceptionYear

public java.lang.String getInceptionYear()

getIssueTrackingUrl

public java.lang.String getIssueTrackingUrl()

getLicenses

public java.util.List getLicenses()

getLogo

public java.lang.String getLogo()

getMailingLists

public java.util.List getMailingLists()

getName

public java.lang.String getName()

getOrganization

public org.apache.maven.project.Organization getOrganization()

getPackage

public java.lang.String getPackage()

getPackageGroups

public java.util.List getPackageGroups()

getPomVersion

public java.lang.String getPomVersion()

getProperties

public java.util.Properties getProperties()

getReports

public java.util.List getReports()

getRepository

public org.apache.maven.project.Repository getRepository()

getShortDescription

public java.lang.String getShortDescription()

getSiteAddress

public java.lang.String getSiteAddress()

getSiteDirectory

public java.lang.String getSiteDirectory()

getUrl

public java.lang.String getUrl()

getVersions

public java.util.List getVersions()

setVersions

public void setVersions(java.util.List list)

setArtifactId

public void setArtifactId(java.lang.String s)

setBranches

public void setBranches(java.util.List list)

setBuild

public void setBuild(org.apache.maven.project.Build build)

setContributors

public void setContributors(java.util.List list)

setCurrentVersion

public void setCurrentVersion(java.lang.String s)

setDependencies

public void setDependencies(java.util.List list)

setDescription

public void setDescription(java.lang.String s)

setDevelopers

public void setDevelopers(java.util.List list)

setDistributionDirectory

public void setDistributionDirectory(java.lang.String s)

setDistributionSite

public void setDistributionSite(java.lang.String s)

setExtend

public void setExtend(java.lang.String s)

setGroupId

public void setGroupId(java.lang.String s)

setGumpRepositoryId

public void setGumpRepositoryId(java.lang.String s)

setInceptionYear

public void setInceptionYear(java.lang.String s)

setIssueTrackingUrl

public void setIssueTrackingUrl(java.lang.String s)

setLicenses

public void setLicenses(java.util.List list)

setLogo

public void setLogo(java.lang.String s)

setMailingLists

public void setMailingLists(java.util.List list)

setName

public void setName(java.lang.String s)

setOrganization

public void setOrganization(org.apache.maven.project.Organization organization)

setPackage

public void setPackage(java.lang.String s)

setPackageGroups

public void setPackageGroups(java.util.List list)

setPomVersion

public void setPomVersion(java.lang.String s)

setProperties

public void setProperties(java.util.Properties properties)

setReports

public void setReports(java.util.List list)

setRepository

public void setRepository(org.apache.maven.project.Repository repository)

setShortDescription

public void setShortDescription(java.lang.String s)

setSiteAddress

public void setSiteAddress(java.lang.String s)

setSiteDirectory

public void setSiteDirectory(java.lang.String s)

setUrl

public void setUrl(java.lang.String s)

addVersion

public void addVersion(org.apache.maven.project.Version version)
Add a distribution to this project.

Parameters:
version - Distribution for this project.

resolveIds

public void resolveIds()
To Do:
hopefully can be replaced by appropraite getters in modello

getProjectAsString

public java.lang.String getProjectAsString()
                                    throws java.lang.Exception
Create an XML string from the project.

Returns:
XML representation of the project
Throws:
java.lang.Exception - FIXME

toString

public java.lang.String toString()

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()


Copyright © 2001-2008 Apache Software Foundation. All Rights Reserved.