public class MavenProject extends Object implements Cloneable
模型中的值保持不变,但在构建项目的过程中可以添加继承和插值等概念。这允许拥有一个在运行时有用的实体,同时保留模型,以便可以对它进行编组和解组,而不会受到运行时要求的污染。
随着 3.2.2 版本中的更改,MavenProject 在构造后更接近于不可变,从此类中删除所有组件,并且前期构造完全由ProjectBuilder
. 仍然存在必须运行生命周期才能找到所有编译源根目录和资源目录的问题,但我希望在 Maven 4.0 版本 (jvz) 期间解决这个问题。
修饰符和类型 | 字段和说明 |
---|---|
static String |
EMPTY_PROJECT_ARTIFACT_ID |
static String |
EMPTY_PROJECT_GROUP_ID |
static String |
EMPTY_PROJECT_VERSION |
构造函数和描述 |
---|
MavenProject() |
MavenProject(MavenProject project) |
MavenProject(Model model) |
public MavenProject()
public MavenProject(Model model)
public MavenProject(MavenProject project)
public File getParentFile()
public void setParentFile(File parentFile)
public Artifact getArtifact()
public void setArtifact(Artifact artifact)
public Model getModel()
public MavenProject getParent()
public void setParent(MavenProject parent)
public boolean hasParent()
public File getFile()
public void setFile(File file)
public void setPomFile(File file)
file
而不更改项目basedir
。public File getBasedir()
public void setDependencies(List<Dependency> dependencies)
public List<Dependency> getDependencies()
public DependencyManagement getDependencyManagement()
public void addCompileSourceRoot(String path)
public void addTestCompileSourceRoot(String path)
public List<String> getCompileClasspathElements() throws DependencyResolutionRequiredException
public List<String> getTestClasspathElements() throws DependencyResolutionRequiredException
public List<String> getRuntimeClasspathElements() throws DependencyResolutionRequiredException
public void setModelVersion(String pomVersion)
public String getModelVersion()
public String getId()
public void setGroupId(String groupId)
public String getGroupId()
public void setArtifactId(String artifactId)
public String getArtifactId()
public void setName(String name)
public String getName()
public void setVersion(String version)
public String getVersion()
public String getPackaging()
public void setPackaging(String packaging)
public void setInceptionYear(String inceptionYear)
public String getInceptionYear()
public void setUrl(String url)
public String getUrl()
public Prerequisites getPrerequisites()
public void setIssueManagement(IssueManagement issueManagement)
public CiManagement getCiManagement()
public void setCiManagement(CiManagement ciManagement)
public IssueManagement getIssueManagement()
public void setDistributionManagement(DistributionManagement distributionManagement)
public DistributionManagement getDistributionManagement()
public void setDescription(String description)
public String getDescription()
public void setOrganization(Organization organization)
public Organization getOrganization()
public void setScm(Scm scm)
public Scm getScm()
public void setMailingLists(List<MailingList> mailingLists)
public List<MailingList> getMailingLists()
public void addMailingList(MailingList mailingList)
public void addDeveloper(Developer developer)
public void setContributors(List<Contributor> contributors)
public List<Contributor> getContributors()
public void addContributor(Contributor contributor)
public void setBuild(Build build)
public Build getBuild()
public void addResource(Resource resource)
public void addTestResource(Resource testResource)
public void addLicense(License license)
public Set<Artifact> getArtifacts()
Set
< Artifact
>to get only direct dependencies
public void setParentArtifact(Artifact parentArtifact)
public Artifact getParentArtifact()
public List<Repository> getRepositories()
public PluginManagement getPluginManagement()
public void setRemoteArtifactRepositories(List<ArtifactRepository> remoteArtifactRepositories)
public List<ArtifactRepository> getRemoteArtifactRepositories()
public void setPluginArtifactRepositories(List<ArtifactRepository> pluginArtifactRepositories)
public List<ArtifactRepository> getPluginArtifactRepositories()
public ArtifactRepository getDistributionManagementArtifactRepository()
public List<Repository> getPluginRepositories()
public List<org.eclipse.aether.repository.RemoteRepository> getRemoteProjectRepositories()
public List<org.eclipse.aether.repository.RemoteRepository> getRemotePluginRepositories()
public void setInjectedProfileIds(String source, List<String> injectedProfileIds)
public Map<String,List<String>> getInjectedProfileIds()
settings.xml
. 配置文件标识符按其来源的标识符分组,例如
<groupId>:<artifactId>:<version>
POM 配置文件或external
来自
settings.xml
.null
。public void addAttachedArtifact(Artifact artifact) throws DuplicateArtifactAttachmentException
MavenProjectHelper
artifact
- 要添加或替换的工件。DuplicateArtifactAttachmentException
- 永远不会发生,但为了向后兼容而保留它public org.codehaus.plexus.util.xml.Xpp3Dom getGoalConfiguration(String pluginGroupId, String pluginArtifactId, String executionId, String goalId)
public MavenProject getExecutionProject()
public void setExecutionProject(MavenProject executionProject)
public List<MavenProject> getCollectedProjects()
public void setCollectedProjects(List<MavenProject> collectedProjects)
@Deprecated public Set<Artifact> getDependencyArtifacts()
Set
< Artifact
>to get all transitive dependencies
@Deprecated public void setDependencyArtifacts(Set<Artifact> dependencyArtifacts)
public void setReleaseArtifactRepository(ArtifactRepository releaseArtifactRepository)
public void setSnapshotArtifactRepository(ArtifactRepository snapshotArtifactRepository)
public void setOriginalModel(Model originalModel)
public Model getOriginalModel()
public void addProjectReference(MavenProject project)
public Properties getProperties()
public Map<String,MavenProject> getProjectReferences()
public boolean isExecutionRoot()
public void setExecutionRoot(boolean executionRoot)
public String getDefaultGoal()
public MavenProject clone()
public void setModel(Model model)
protected void setTestCompileSourceRoots(List<String> testCompileSourceRoots)
protected ArtifactRepository getReleaseArtifactRepository()
protected ArtifactRepository getSnapshotArtifactRepository()
public void setContextValue(String key, Object value)
null
,则从该项目中删除上下文值。上下文值旨在允许核心扩展将派生状态与项目实例相关联。public void setClassRealm(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm)
classRealm
- 托管此项目的构建扩展的类领域,可能是null
.public org.codehaus.plexus.classworlds.realm.ClassRealm getClassRealm()
null
.public void setExtensionDependencyFilter(org.eclipse.aether.graph.DependencyFilter extensionDependencyFilter)
extensionDependencyFilter
- 应用到插件的依赖过滤器,可能是null
.public org.eclipse.aether.graph.DependencyFilter getExtensionDependencyFilter()
null
.public void setResolvedArtifacts(Set<Artifact> artifacts)
artifacts
- 工件集,可能是null
.public void setArtifactFilter(ArtifactFilter artifactFilter)
artifactFilter
- 工件过滤器,可能是null
排除所有工件。public boolean hasLifecyclePhase(String phase)
phase
- 要检查的相位,不能是null
。true
如果已经看到相位。public void addLifecyclePhase(String lifecyclePhase)
lifecyclePhase
- 要添加的生命周期阶段,不能是null
.@Deprecated public String getModulePathAdjustment(MavenProject moduleProject) throws IOException
IOException
@Deprecated public Set<Artifact> createArtifacts(ArtifactFactory artifactFactory, String inheritedScope, ArtifactFilter filter) throws InvalidDependencyVersionException
@Deprecated protected void setScriptSourceRoots(List<String> scriptSourceRoots)
@Deprecated public void addScriptSourceRoot(String path)
@Deprecated public List<String> getScriptSourceRoots()
@Deprecated public List<Artifact> getCompileArtifacts()
@Deprecated public List<Dependency> getCompileDependencies()
@Deprecated public List<Artifact> getTestArtifacts()
@Deprecated public List<Dependency> getTestDependencies()
@Deprecated public List<Dependency> getRuntimeDependencies()
@Deprecated public List<Artifact> getRuntimeArtifacts()
@Deprecated public List<String> getSystemClasspathElements() throws DependencyResolutionRequiredException
@Deprecated public List<Artifact> getSystemArtifacts()
@Deprecated public List<Dependency> getSystemDependencies()
@Deprecated public void setReporting(Reporting reporting)
@Deprecated public Reporting getReporting()
@Deprecated public void setReportArtifacts(Set<Artifact> reportArtifacts)
@Deprecated public Set<Artifact> getReportArtifacts()
@Deprecated public Map<String,Artifact> getReportArtifactMap()
@Deprecated public void setExtensionArtifacts(Set<Artifact> extensionArtifacts)
@Deprecated public Set<Artifact> getExtensionArtifacts()
@Deprecated public Map<String,Artifact> getExtensionArtifactMap()
@Deprecated public List<ReportPlugin> getReportPlugins()
@Deprecated public org.codehaus.plexus.util.xml.Xpp3Dom getReportConfiguration(String pluginGroupId, String pluginArtifactId, String reportSetId)
@Deprecated public void attachArtifact(String type, String classifier, File file)
@Deprecated public void writeModel(Writer writer) throws IOException
ModelWriter
.IOException
@Deprecated public void writeOriginalModel(Writer writer) throws IOException
ModelWriter
.IOException
@Deprecated public Artifact replaceWithActiveArtifact(Artifact pluginArtifact)
@Deprecated public ProjectBuildingRequest getProjectBuildingRequest()
null
.@Deprecated public void setProjectBuildingRequest(ProjectBuildingRequest projectBuildingRequest)
projectBuildingRequest
- 项目建设要求,可能是null
。版权所有 © 2001–2022 Apache 软件基金会。版权所有。