Class JvmProjectSourceBlobCreator


  • public class JvmProjectSourceBlobCreator
    extends Object
    • Constructor Detail

      • JvmProjectSourceBlobCreator

        public JvmProjectSourceBlobCreator()
    • Method Detail

      • create

        public static SourceBlobDescriptor create​(Path projectDirectory,
                                                  String clientString,
                                                  List<Path> includedProjectFiles,
                                                  Supplier<Procfile> customProcfileResolver,
                                                  Procfile defaultProcfile,
                                                  Supplier<Optional<String>> customJdkVersionResolver,
                                                  OutputAdapter outputAdapter)
                                           throws IOException,
                                                  IllegalArgumentException
        Creates a SourceBlobDescriptor based on a given project directory and custom resolvers. It assumes a JVM application. Projects using heroku-deploy should stick to a core source blob that is consistent across, for example, build tool plugins for Maven, sbt and others. This method takes a project directory and extracts common information like process types, JDK versions and overlays from it. It will create synthetic a Procfile, system.properties and .heroku-deploy metadata file. In many cases, those will not be the actual files found in the project directory. See the specific resolvers where specific values are read from and in which order. The returned SourceBlobDescriptor can then be enhanced with specific files that, for example, resulted in a build process.
        Parameters:
        projectDirectory - Absolute path to the project directory.
        clientString - The client string of the plugin/tool that will upload the source blob. It will be written to the .heroku-deploy metadata file.
        includedProjectFiles - Paths (relative to the project directory) for inclusion into the source blob. They are treated as user-input and will be validated and normalized prior to inclusion. User-readable errors are written to the given outputAdapter.
        customProcfileResolver - A supplier that is called to add additional procfile entries on top of the ones specified in the Procfile contained in the project directory. Used with ProcfileResolver.
        defaultProcfile - If no process types are defined in the projects Procfile and customProcfileResolver, this procfile will be included in the source blob.
        customJdkVersionResolver - A supplier that is called to get the customers desired JDK version. Used for JdkVersionResolver.
        outputAdapter - This class will output messages meant for the user and uses the given OutputAdapter for that.
        Returns:
        A SourceBlobDescriptor valid for any JVM project that can be extended with actual jar/war files later.
        Throws:
        IOException - Resolving metadata involves IO. In case those operations fail, an IOException will be thrown.
        IllegalArgumentException - If the given projectDirectory is not an absolute path.
        See Also:
        JdkVersionResolver, ProcfileResolver