Class MavenShellCallback

java.lang.Object
org.mybatis.generator.internal.DefaultShellCallback
org.mybatis.generator.maven.MavenShellCallback
All Implemented Interfaces:
ShellCallback

public class MavenShellCallback extends DefaultShellCallback
Shell callback that calculates the Maven output directory.
  • Field Details

  • Constructor Details

    • MavenShellCallback

      public MavenShellCallback(MyBatisGeneratorMojo mybatisGeneratorMojo, boolean overwrite)
  • Method Details

    • getDirectory

      public File getDirectory(String targetProject, String targetPackage) throws ShellException
      Description copied from interface: ShellCallback
      This method is called to ask the shell to resolve a project/package combination into a directory on the file system. This method is called repeatedly (once for each generated file), so it would be wise for an implementing class to cache results.

      The returned java.io.File object:

      • Must be a directory
      • Must exist

      The default shell callback interprets both values as directories and simply concatenates the two values to generate the default directory.

      Specified by:
      getDirectory in interface ShellCallback
      Overrides:
      getDirectory in class DefaultShellCallback
      Parameters:
      targetProject - the target project
      targetPackage - the target package
      Returns:
      the directory (must exist)
      Throws:
      ShellException - if the project/package cannot be resolved into a directory on the file system. In this case, the generator will not save the file it is currently working on. The generator will add the exception message to the list of warnings automatically.