Class BaseScriptUtils
- java.lang.Object
-
- groovy.lang.GroovyObjectSupport
-
- groovy.lang.Script
-
- org.commonjava.maven.ext.core.groovy.BaseScriptUtils
-
- All Implemented Interfaces:
GroovyObject
,CommonBaseScript
,MavenBaseScript
- Direct Known Subclasses:
BaseScript
public abstract class BaseScriptUtils extends Script implements MavenBaseScript
Abstract class that contains useful utility functions for developers wishing to implement groovy scripts for PME.
-
-
Constructor Summary
Constructors Constructor Description BaseScriptUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Logger
getLogger()
void
inlineProperty(org.commonjava.maven.ext.common.model.Project currentProject, String propertyKey)
Allows the specified property to be inlined.void
inlineProperty(org.commonjava.maven.ext.common.model.Project currentProject, ProjectRef groupArtifact)
Allows the specified group:artifact property to be inlined.void
overrideProjectVersion(ProjectVersionRef gav)
This is useful for a series of builds with circular dependencies.protected void
reinitialiseSessionStates()
This will re-initialise any state linked to this session.protected void
validateSession()
-
Methods inherited from class groovy.lang.Script
evaluate, evaluate, getBinding, getProperty, invokeMethod, print, printf, printf, println, println, run, run, setBinding, setProperty
-
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClass
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.commonjava.maven.ext.core.groovy.CommonBaseScript
getBaseDir, getFileIO, getInvocationStage, getRESTAPI, getUserProperties
-
Methods inherited from interface org.commonjava.maven.ext.core.groovy.MavenBaseScript
getGAV, getModelIO, getPomIO, getProject, getProjects, getSession
-
-
-
-
Method Detail
-
inlineProperty
public void inlineProperty(org.commonjava.maven.ext.common.model.Project currentProject, ProjectRef groupArtifact) throws org.commonjava.maven.ext.common.ManipulationException
Allows the specified group:artifact property to be inlined. This is useful to split up properties that cover multiple separate projects.- Parameters:
currentProject
- The current project we are operating on.groupArtifact
- A ProjectRef corresponding to the group and artifact of the dependency (or managed dependency) that we wish to inline. An artifactId may be a wildcard (i.e. '*').- Throws:
org.commonjava.maven.ext.common.ManipulationException
- if an error occurs.
-
inlineProperty
public void inlineProperty(org.commonjava.maven.ext.common.model.Project currentProject, String propertyKey) throws org.commonjava.maven.ext.common.ManipulationException
Allows the specified property to be inlined. This is useful to split up properties that cover multiple separate projects.- Parameters:
currentProject
- The current project we are operating on.propertyKey
- The property which is within the dependencies (or managed dependencies) that we wish to inline.- Throws:
org.commonjava.maven.ext.common.ManipulationException
- if an error occurs.
-
validateSession
protected void validateSession() throws org.commonjava.maven.ext.common.ManipulationException
- Throws:
org.commonjava.maven.ext.common.ManipulationException
-
reinitialiseSessionStates
protected void reinitialiseSessionStates() throws org.commonjava.maven.ext.common.ManipulationException
This will re-initialise any state linked to this session. This is useful if the user properties have been updated.- Throws:
org.commonjava.maven.ext.common.ManipulationException
- if an error occurs.
-
overrideProjectVersion
public void overrideProjectVersion(ProjectVersionRef gav) throws org.commonjava.maven.ext.common.ManipulationException
This is useful for a series of builds with circular dependencies. It will allow a developer to use an original 'target' build to align the project version to. The engineer should pass in the unaligned GAV (i.e. without the rebuild suffix) of the first SCM root build. Then the subsequent builds, rather than using incremental suffix which can cause issues with circular dependencies, will use versionSuffix and lock to the root build version. This function will query DA to obtain the correct current suffix to use.- Parameters:
gav
- the target build to obtain the suffix to align to.- Throws:
org.commonjava.maven.ext.common.ManipulationException
- if an error occurs.
-
getLogger
public Logger getLogger()
-
-