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, 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 Details

    • CDS_SERVICES_GROUPID

      protected static final String CDS_SERVICES_GROUPID
      See Also:
    • PLUGIN_KEY

      public static final String 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 mojoExecution
      The current MojoExecution. 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 project
      The current Maven project on which this goal is executed.
    • session

      @Parameter(defaultValue="${session}", required=true, readonly=true) protected org.apache.maven.execution.MavenSession session
      The current Maven execution session.
    • settings

      @Parameter(defaultValue="${settings}", required=true, readonly=true) protected org.apache.maven.settings.Settings settings
      The 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, otherwise false.
    • logDebug

      public void logDebug(String message, Object... args)
      Description copied from interface: CdsMojoLogger
      Writes a debug message to log.
      Specified by:
      logDebug in interface CdsMojoLogger
      Parameters:
      message - the message
      args - the arguments
    • logDebug

      public void logDebug(Throwable error)
      Description copied from interface: CdsMojoLogger
      Writes a debug message to log.
      Specified by:
      logDebug in interface CdsMojoLogger
      Parameters:
      error - the exception causing this debug entry
    • logError

      public void logError(String message, Object... args)
      Description copied from interface: CdsMojoLogger
      Writes an error message to log.
      Specified by:
      logError in interface CdsMojoLogger
      Parameters:
      message - the message
      args - the arguments
    • logError

      public void logError(String message, Throwable error, Object... args)
      Description copied from interface: CdsMojoLogger
      Writes an error message to log.
      Specified by:
      logError in interface CdsMojoLogger
      Parameters:
      message - the message
      error - the exception causing the error
      args - the arguments
    • logError

      public void logError(Throwable error)
      Description copied from interface: CdsMojoLogger
      Writes an error message to log.
      Specified by:
      logError in interface CdsMojoLogger
      Parameters:
      error - the exception causing the error entry
    • logInfo

      public void logInfo(String message, Object... args)
      Description copied from interface: CdsMojoLogger
      Writes a debug message to log.
      Specified by:
      logInfo in interface CdsMojoLogger
      Parameters:
      message - the message
      args - the arguments
    • logWarn

      public void logWarn(String message, Object... args)
      Description copied from interface: CdsMojoLogger
      Writes a warning message to log.
      Specified by:
      logWarn in interface CdsMojoLogger
      Parameters:
      message - the message
      args - the arguments
    • logWarn

      public void logWarn(String message, Throwable error, Object... args)
      Description copied from interface: CdsMojoLogger
      Writes a warning message to log.
      Specified by:
      logWarn in interface CdsMojoLogger
      Parameters:
      message - the message
      error - the exception causing the warning
      args - the arguments
    • logWarn

      public void logWarn(Throwable error)
      Description copied from interface: CdsMojoLogger
      Writes a warning message to log.
      Specified by:
      logWarn in interface CdsMojoLogger
      Parameters:
      error - the exception causing the warning
    • ensureCliExecuted

      protected void ensureCliExecuted() throws org.apache.maven.plugin.MojoExecutionException
      Ensures 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

      protected File getReactorBaseDirectory()
    • scanDirectory

      protected List<File> scanDirectory(File baseDir, String... includes)
      Scans the given directory for files satisfying the given glob pattern.
      Parameters:
      baseDir - the base directory to start scanning
      includes - an array of glob based file pattern, for example, **/csn.json
      Returns:
      a list with files
    • setProperty

      protected void setProperty(String name, File value)
    • findGoalExecution

      protected static org.apache.maven.model.PluginExecution findGoalExecution(org.apache.maven.model.Plugin plugin, String goalName)
    • strong

      protected static String strong(Object text)