Package com.sap.cds.maven.plugin
Class AbstractCdsMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.sap.cds.maven.plugin.AbstractCdsMojo
- All Implemented Interfaces:
CdsMojoLogger
,org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AddIntegrationTestMojo
,AddMojo
,AddSampleMojo
,AddTargetPlatformMojo
,BuildMojo
,CdsMojo
,CleanMojo
,GenerateMojo
,InstallCdsdkMojo
,InstallNodeMojo
,NpmMojo
,NpxMojo
,VersionMojo
public abstract class AbstractCdsMojo
extends org.apache.maven.plugin.AbstractMojo
implements CdsMojoLogger
An abstract base class for all CDS-related Mojos (Maven Old Java Object)
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.sonatype.plexus.build.incremental.BuildContext
static final String
protected org.apache.maven.plugin.MojoExecution
The currentMojoExecution
.static final String
The key of this plugin.protected org.apache.maven.project.MavenProject
The current Maven project on which this goal is executed.protected org.apache.maven.execution.MavenSession
The current Maven execution session.protected org.apache.maven.settings.Settings
The global Maven settings, stored in~/.m2/settings.xml
.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Ensures that the goal is executed from command line.protected static org.apache.maven.model.PluginExecution
findGoalExecution
(org.apache.maven.model.Plugin plugin, String goalName) protected org.apache.maven.project.MavenProject
protected File
boolean
Indicates whether this goal is executed from command line or not.void
Writes a debug message to log.void
Writes a debug message to log.void
Writes an error message to log.void
Writes an error message to log.void
Writes an error message to log.void
Writes a debug message to log.void
Writes a warning message to log.void
Writes a warning message to log.void
Writes a warning message to log.scanDirectory
(File baseDir, String... includes) Scans the given directory for files satisfying the given glob pattern.protected void
setProperty
(String name, File value) protected static String
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
CDS_SERVICES_GROUPID
- See Also:
-
PLUGIN_KEY
The key of this plugin.- See Also:
-
buildContext
@Component protected org.sonatype.plexus.build.incremental.BuildContext buildContext -
mojoExecution
@Parameter(defaultValue="${mojoExecution}", required=true, readonly=true) protected org.apache.maven.plugin.MojoExecution mojoExecutionThe currentMojoExecution
. Used to determine if goal is executed from command line or from lifecycle phase. -
project
@Parameter(defaultValue="${project}", required=true, readonly=true) protected org.apache.maven.project.MavenProject projectThe current Maven project on which this goal is executed. -
session
@Parameter(defaultValue="${session}", required=true, readonly=true) protected org.apache.maven.execution.MavenSession sessionThe current Maven execution session. -
settings
@Parameter(defaultValue="${settings}", required=true, readonly=true) protected org.apache.maven.settings.Settings settingsThe global Maven settings, stored in~/.m2/settings.xml
.
-
-
Constructor Details
-
AbstractCdsMojo
protected AbstractCdsMojo()
-
-
Method Details
-
isCliExecuted
public boolean isCliExecuted()Indicates whether this goal is executed from command line or not.- Returns:
true
if goal is invoked from command line, otherwisefalse
.
-
logDebug
Description copied from interface:CdsMojoLogger
Writes a debug message to log.- Specified by:
logDebug
in interfaceCdsMojoLogger
- Parameters:
message
- the messageargs
- the arguments
-
logDebug
Description copied from interface:CdsMojoLogger
Writes a debug message to log.- Specified by:
logDebug
in interfaceCdsMojoLogger
- Parameters:
error
- the exception causing this debug entry
-
logError
Description copied from interface:CdsMojoLogger
Writes an error message to log.- Specified by:
logError
in interfaceCdsMojoLogger
- Parameters:
message
- the messageargs
- the arguments
-
logError
Description copied from interface:CdsMojoLogger
Writes an error message to log.- Specified by:
logError
in interfaceCdsMojoLogger
- Parameters:
message
- the messageerror
- the exception causing the errorargs
- the arguments
-
logError
Description copied from interface:CdsMojoLogger
Writes an error message to log.- Specified by:
logError
in interfaceCdsMojoLogger
- Parameters:
error
- the exception causing the error entry
-
logInfo
Description copied from interface:CdsMojoLogger
Writes a debug message to log.- Specified by:
logInfo
in interfaceCdsMojoLogger
- Parameters:
message
- the messageargs
- the arguments
-
logWarn
Description copied from interface:CdsMojoLogger
Writes a warning message to log.- Specified by:
logWarn
in interfaceCdsMojoLogger
- Parameters:
message
- the messageargs
- the arguments
-
logWarn
Description copied from interface:CdsMojoLogger
Writes a warning message to log.- Specified by:
logWarn
in interfaceCdsMojoLogger
- Parameters:
message
- the messageerror
- the exception causing the warningargs
- the arguments
-
logWarn
Description copied from interface:CdsMojoLogger
Writes a warning message to log.- Specified by:
logWarn
in interfaceCdsMojoLogger
- Parameters:
error
- the exception causing the warning
-
ensureCliExecuted
protected void ensureCliExecuted() throws org.apache.maven.plugin.MojoExecutionExceptionEnsures that the goal is executed from command line.- Throws:
org.apache.maven.plugin.MojoExecutionException
- if goal isn't invoked from command line
-
findSrvProject
protected org.apache.maven.project.MavenProject findSrvProject() -
getReactorBaseDirectory
-
scanDirectory
Scans the given directory for files satisfying the given glob pattern.- Parameters:
baseDir
- the base directory to start scanningincludes
- an array of glob based file pattern, for example,**/csn.json
- Returns:
- a list with files
-
setProperty
-
findGoalExecution
protected static org.apache.maven.model.PluginExecution findGoalExecution(org.apache.maven.model.Plugin plugin, String goalName) -
strong
-