org.apache.maven.project
Class Project

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

public class Project
extends BaseObject

Version:
$Id: Project.java,v 1.91.4.20 2004/06/26 14:52:05 dion Exp $
Author:
Jason van Zyl, Vincent Massol, Glenn McAllister

Field Summary
 
Fields inherited from class org.apache.maven.project.BaseObject
id
 
Constructor Summary
Project()
          Default constructor.
 
Method Summary
 void addBranch(Branch branch)
          Add a branch to this project.
 void addContributor(Contributor contributor)
          Add a contributor to this project.
 void addDependency(Dependency dependency)
          Add a unique dependency for this project.
 void addDeveloper(Developer developer)
          Add a developer to this project.
 void addLicense(License license)
          Add a license to this project.
 void addMailingList(MailingList mailingList)
          Add a mailing list for this project.
 void addPackageGroup(PackageGroup packageGroup)
          Adds a new PackageGroup to this project
 void addReport(java.lang.String report)
          Add a unique report for this project.
 void addVersion(Version version)
          Add a distribution to this project.
 void buildArtifactList()
          Build the artifact list.
 org.dom4j.Document createDocument()
          Create a dom4j document from the POM.
 java.lang.String getArtifactDirectory()
           
 java.lang.String getArtifactId()
          Get the artifact id.
 java.util.List getArtifacts()
          Get the atrifact attribute.
 java.util.List getBranches()
          Return the branches for this project.
 Build getBuild()
          Get the build model for this project.
 MavenJellyContext getContext()
          Get the context attribute.
 java.util.List getContributors()
          Return the contributors for this project.
 java.lang.String getCurrentVersion()
          Gets the currentVersion attribute of the Project object.
 java.util.List getDependencies()
          Get the list of dependencies for this 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()
          Gets the description attribute of the Project object.
 java.util.List getDevelopers()
          Return the developers for this project.
 java.lang.String getDistributionDirectory()
          Get the project's distribution directory.
 java.lang.String getDistributionSite()
          Get the project's distribution site.
 java.lang.String getExtend()
          Get the path to the file that this project extends.
 java.io.File getFile()
          Get the file this POM was derived from
 java.lang.String getGroupId()
          The group id in a particular POM refers to a real id of another project.
 java.lang.String getGumpRepositoryId()
          Get the gump repository descriptor.
 java.lang.String getId()
          Gets the id attribute
 java.lang.String getInceptionYear()
          Gets the inceptionYear attribute of the Project object
 java.lang.String getIssueTrackingUrl()
          Set the URL to this project's issue tracking system.
 java.util.List getLicenses()
          Return the licenses for this project.
 java.lang.String getLogo()
          Return the project logo image URL.
 java.util.List getMailingLists()
          Return the mailing lists for this project.
 java.io.File getMavenXml()
           
 Organization getOrganization()
          Get the Project Organization.
 java.lang.String getPackage()
          Gets the package attribute of the Project object.
 java.util.List getPackageGroups()
          Returns a list of PackageGroup instances used for documenting the packages
 Project getParent()
           
 MavenJellyContext getPluginContext(java.lang.String pluginId)
          Deprecated. use the tag instead
 java.lang.String getPomVersion()
          Gets the version attribute of the Project object.
 java.util.List getReports()
          Get the list of dependencies for this project.
 Repository getRepository()
          Return the repository used by this project.
 java.lang.String getShortDescription()
          Get short description
 java.lang.String getSiteAddress()
          Get the projects site address.
 java.lang.String getSiteDirectory()
          Get the project's site directory.
 java.lang.String getUrl()
          Set the URL to this project's main page.
 Version getVersionById(java.lang.String versionId)
          Return a distribution for this project.
 java.util.List getVersions()
          Return the distributions for this project.
 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.
static java.lang.String legacyToStandardId(java.lang.String id)
          This is to support methods that are using the legacy form of the project id.
 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 setArtifactId(java.lang.String artifactId)
          Set the artifactId for this project.
 void setArtifacts(java.util.List artifactList)
          Set the artifactList attribute.
 void setBranches(java.util.List branches)
          Set the branches for this project.
 void setBuild(Build build)
          Sets the build attribute of the Project object
 void setContext(MavenJellyContext context)
          Set the context attribute.
 void setContributors(java.util.List contributors)
          Set contributors for this project.
 void setCurrentVersion(java.lang.String currentVersion)
          Sets the currentVersion attribute of the Project object.
 void setDependencies(java.util.List dependencies)
          Set a list of dependencies.
 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 description)
          Sets the description attribute of the Project object.
 void setDevelopers(java.util.List developers)
          Set the list of developers for this project.
 void setDistributionDirectory(java.lang.String distributionDirectory)
          Set the distribution directory.
 void setDistributionSite(java.lang.String distributionSite)
          Set the distribution site.
 void setExtend(java.lang.String pomToExtend)
          Set the path to the file that this project extends.
 void setFile(java.io.File file)
          Set the file that this POM was derived from.
 void setGroupId(java.lang.String groupId)
          Set the project group id.
 void setGumpRepositoryId(java.lang.String gumpRepositoryId)
          Set the gump repository descriptor.
 void setInceptionYear(java.lang.String inceptionYear)
          Sets the inceptionYear attribute of the Project object.
 void setIssueTrackingUrl(java.lang.String issueTrackingUrl)
          Sets the issueTrackingUrl attribute of the Project object.
 void setLicenses(java.util.List licenses)
          Set licenses for this project.
 void setLogo(java.lang.String logo)
          Set the project logo image URL.
 void setMailingLists(java.util.List mailingLists)
          Set mailing lists.
 void setOrganization(Organization organization)
          Sets the project Organization.
 void setPackage(java.lang.String projectPackage)
          Sets the package attribute of the Project object.
 void setPackageGroups(java.util.List packageGroups)
          Sets the list of PackageGroup instances used for documenting the packages
 void setParent(Project parent)
          Set the project that this one extends
 void setPomVersion(java.lang.String pomVersion)
          Sets the version attribute of the Project object
 void setReports(java.util.List reports)
          Set a list of dependencies.
 void setRepository(Repository repository)
          Set the repository for this project.
 void setShortDescription(java.lang.String shortDescription)
          Set short description
 void setSiteAddress(java.lang.String siteAddress)
          Set the site address where the documentation lives.
 void setSiteDirectory(java.lang.String siteDirectory)
          Set the site directory where the documentation lives.
 void setUrl(java.lang.String url)
          Sets the url attribute of the Project object.
 void setVersions(java.util.List versions)
          Set the versions for this project.
static java.lang.String standardToLegacyId(java.lang.String id)
          This method is to support methods are expecting legacy ids.
 void verifyDependencies()
          Verify the dependencies for this project.
 
Methods inherited from class org.apache.maven.project.BaseObject
addProperty, equals, getName, getProperties, getProperty, hashCode, isValid, resolvedProperties, setId, setName, setProperties, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Project

public Project()
Default constructor.

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()
Description copied from class: BaseObject
Gets the id attribute

Overrides:
getId in class BaseObject
Returns:
the id of the project

setArtifactId

public void setArtifactId(java.lang.String artifactId)
Set the artifactId for this project. This is used to produce distributable artifacts.

Parameters:
artifactId - The artifactId.

getArtifactId

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

Returns:
The artifactId

setGroupId

public void setGroupId(java.lang.String groupId)
Set the project group id.

Parameters:
groupId - Project group id.

getGroupId

public java.lang.String getGroupId()
The group id in a particular POM refers to a real id of another project. We will use the Jelly and its tag libraries as an example of how this mechanism works.

Jelly has a separate build for each Jelly tag lib that contributes to the overall family of tag libs. Much of the information required to build each tag library is shared so Maven's extension mechanism is utilized.

We want each Jelly tag lib to have a group id of 'commons-jelly' because we want the resultant artifact to be of the form 'commons-jelly-X' where X is the id of the individual tag lib.

Returns:
Project group id.

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

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

setExtend

public void setExtend(java.lang.String pomToExtend)
Set the path to the file that this project extends.

Parameters:
pomToExtend - Project which this project extends.

getExtend

public java.lang.String getExtend()
Get the path to the file that this project extends.

Returns:
Name of POM file that this project extends.

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.

setGumpRepositoryId

public void setGumpRepositoryId(java.lang.String gumpRepositoryId)
Set the gump repository descriptor.

Parameters:
gumpRepositoryId - Gump repository id.

getGumpRepositoryId

public java.lang.String getGumpRepositoryId()
Get the gump repository descriptor.

Returns:
Gump repository id.

setShortDescription

public void setShortDescription(java.lang.String shortDescription)
Set short description

Parameters:
shortDescription - Short description of project.

getShortDescription

public java.lang.String getShortDescription()
Get short description

Returns:
Short description of project.

getArtifactDirectory

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

setSiteAddress

public void setSiteAddress(java.lang.String siteAddress)
Set the site address where the documentation lives.

Parameters:
siteAddress - the hostname of the web server that hosts the project's web site (ex: "jakarta.apache.org")

getSiteAddress

public java.lang.String getSiteAddress()
Get the projects site address.

Returns:
the site address

setSiteDirectory

public void setSiteDirectory(java.lang.String siteDirectory)
Set the site directory where the documentation lives.

Parameters:
siteDirectory - the directory on the web server where the public web site for this project resides (ex: "/www/maven.apache.org/")

getSiteDirectory

public java.lang.String getSiteDirectory()
Get the project's site directory.

Returns:
the site directory

setDistributionSite

public void setDistributionSite(java.lang.String distributionSite)
Set the distribution site.

Parameters:
distributionSite - the server where the final distributions will be published

getDistributionSite

public java.lang.String getDistributionSite()
Get the project's distribution site.

Returns:
the distribution site

setDistributionDirectory

public void setDistributionDirectory(java.lang.String distributionDirectory)
Set the distribution directory.

Parameters:
distributionDirectory - the directory on the web server where the final distributions will be published (ex: "/www/maven.apache.org/builds/")

getDistributionDirectory

public java.lang.String getDistributionDirectory()
Get the project's distribution directory.

Returns:
the distribution directory

addDependency

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

Parameters:
dependency - Dependency for this project.

setDependencies

public void setDependencies(java.util.List dependencies)
Set a list of dependencies.

Parameters:
dependencies - List of dependencies to add to the project.

getDependencies

public java.util.List getDependencies()
Get the list of dependencies for this project.

Returns:
the dependencies for this project

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 Dependency getDependency(java.lang.String depId)
Get an individual dependency by id.

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

addReport

public void addReport(java.lang.String report)
Add a unique report for this project.

Parameters:
report - report for this project.

setReports

public void setReports(java.util.List reports)
Set a list of dependencies.

Parameters:
reports - the reports this project will produce

getReports

public java.util.List getReports()
Get the list of dependencies for this project.

Returns:
the dependencies for this project

setBuild

public void setBuild(Build build)
Sets the build attribute of the Project object

Parameters:
build - the build environment of a project

getBuild

public Build getBuild()
Get the build model for this project.

Returns:
the build attribute of the Project object

addMailingList

public void addMailingList(MailingList mailingList)
Add a mailing list for this project.

Parameters:
mailingList - Mailing list for this project.

setMailingLists

public void setMailingLists(java.util.List mailingLists)
Set mailing lists.

Parameters:
mailingLists - Set the mailing lists for the project.

getMailingLists

public java.util.List getMailingLists()
Return the mailing lists for this project.

Returns:
List of mailing lists.

addDeveloper

public void addDeveloper(Developer developer)
Add a developer to this project.

Parameters:
developer - Developer for this project.

setDevelopers

public void setDevelopers(java.util.List developers)
Set the list of developers for this project.

Parameters:
developers - Project developers.

getDevelopers

public java.util.List getDevelopers()
Return the developers for this project.

Returns:
List of developers.

setContributors

public void setContributors(java.util.List contributors)
Set contributors for this project.

Parameters:
contributors - Contributors for this project.

addContributor

public void addContributor(Contributor contributor)
Add a contributor to this project.

Parameters:
contributor - Contributor for this project.

getContributors

public java.util.List getContributors()
Return the contributors for this project.

Returns:
List of contributors.

setLicenses

public void setLicenses(java.util.List licenses)
Set licenses for this project.

Parameters:
licenses - Licenses for this project.

addLicense

public void addLicense(License license)
Add a license to this project.

Parameters:
license - License for this project.

getLicenses

public java.util.List getLicenses()
Return the licenses for this project.

Returns:
List of licenses.

setRepository

public void setRepository(Repository repository)
Set the repository for this project.

Parameters:
repository - the repository this project is part of

getRepository

public Repository getRepository()
Return the repository used by this project.

Returns:
Repository for this project

setUrl

public void setUrl(java.lang.String url)
Sets the url attribute of the Project object.

Parameters:
url - the URL to the organization's home page

getUrl

public java.lang.String getUrl()
Set the URL to this project's main page.

Returns:
the URL to the organization's home page

setIssueTrackingUrl

public void setIssueTrackingUrl(java.lang.String issueTrackingUrl)
Sets the issueTrackingUrl attribute of the Project object.

Parameters:
issueTrackingUrl - the URL to the project's issue tracking system

getIssueTrackingUrl

public java.lang.String getIssueTrackingUrl()
Set the URL to this project's issue tracking system.

Returns:
the URL to the project's issue tracking system

setDescription

public void setDescription(java.lang.String description)
Sets the description attribute of the Project object.

Parameters:
description - the long description of the project

getDescription

public java.lang.String getDescription()
Gets the description attribute of the Project object.

Returns:
the long description of the project

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

setCurrentVersion

public void setCurrentVersion(java.lang.String currentVersion)
Sets the currentVersion attribute of the Project object.

Parameters:
currentVersion - the current version number of the project, e.g. 1.0, 1.1-dev

getCurrentVersion

public java.lang.String getCurrentVersion()
Gets the currentVersion attribute of the Project object.

Returns:
the current version of the project e.g. 1.0, 1.1-dev

setOrganization

public void setOrganization(Organization organization)
Sets the project Organization.

Parameters:
organization - the organisation name

getOrganization

public Organization getOrganization()
Get the Project Organization.

Returns:
the Project Organization object.

setPackage

public void setPackage(java.lang.String projectPackage)
Sets the package attribute of the Project object.

Parameters:
projectPackage - the package name, e.g. org.apache.maven

getPackage

public java.lang.String getPackage()
Gets the package attribute of the Project object.

Returns:
the base package name for the project, e.g. org.apache.maven

setInceptionYear

public void setInceptionYear(java.lang.String inceptionYear)
Sets the inceptionYear attribute of the Project object.

Parameters:
inceptionYear - the year the project started, e.g. 2000

getInceptionYear

public java.lang.String getInceptionYear()
Gets the inceptionYear attribute of the Project object

Returns:
the inception year

setPomVersion

public void setPomVersion(java.lang.String pomVersion)
Sets the version attribute of the Project object

Parameters:
pomVersion - the new value

getPomVersion

public java.lang.String getPomVersion()
Gets the version attribute of the Project object.

Returns:
the version of the project object specified or 1 if no value is provided

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

addVersion

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

Parameters:
version - Distribution for this project.

setVersions

public void setVersions(java.util.List versions)
Set the versions for this project.

Parameters:
versions - List of versions for this project.

getVersions

public java.util.List getVersions()
Return the distributions for this project.

Returns:
List of distributions.

addBranch

public void addBranch(Branch branch)
Add a branch to this project.

Parameters:
branch - Branch for this project.

setBranches

public void setBranches(java.util.List branches)
Set the branches for this project.

Parameters:
branches - List of branches for this project.

getBranches

public java.util.List getBranches()
Return the branches for this project.

Returns:
List of branches.

getVersionById

public 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.

setLogo

public void setLogo(java.lang.String logo)
Set the project logo image URL.

Parameters:
logo - the url for the project logo image.

getLogo

public java.lang.String getLogo()
Return the project logo image URL.

Returns:
the logo image URL

getPackageGroups

public java.util.List getPackageGroups()
Returns a list of PackageGroup instances used for documenting the packages

Returns:
the list of PackageGroup instances

setPackageGroups

public void setPackageGroups(java.util.List packageGroups)
Sets the list of PackageGroup instances used for documenting the packages

Parameters:
packageGroups - is the list of PackageGroup instances

addPackageGroup

public void addPackageGroup(PackageGroup packageGroup)
Adds a new PackageGroup to this project

Parameters:
packageGroup - is the new PackageGroup instance to be added to the list

createDocument

public org.dom4j.Document createDocument()
                                  throws java.lang.Exception
Create a dom4j document from the POM. Used for dvsl processing right now. Hopefully we can make this more general so that people can use the POM in XSLT transformations. This is not working for some reason, I believe due to encoding problems. This might be working now but I will test it later.

Returns:
Document Dom4j document.
Throws:
java.lang.Exception - If an error occurs while creating the dom4j document.

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.lang.Exception - If an error occurs during project initialization.
java.io.IOException

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

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


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