Deploy Heroku Maven project with multiple modules

1

I have a Maven (web) project consisting of a packer project ( packaging = pom ) and several modules. I want to deploy this project in Heroku.

Questions:

  • Where should Procfile be? In the wrapping project or the web project?

  • How should be Procfile ?

  • pom.xml of the packer project:

    <project xmlns="http://maven.apache.org/POM/4.0.0" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>valor.alterado.para.stackoverflow</groupId>
      <artifactId>stackoverflow-package</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>pom</packaging>
    
      <modules>
        <module>../stackoverflow-web</module>
        <module>../stackoverflow-service</module>
        <module>../stackoverflow-business</module>
        <module>../stackoverflow-model</module>
        <module>../stackoverflow-commons</module>
      </modules>
    
    </project>
    
        
    asked by anonymous 08.05.2017 / 21:45

    1 answer

    0

    Your Procfile must be in the root of the project, that is, in the same directory as your wrapper project is.

    If your application is a web server and the final artifact is a jar file, then its Procfile should look like this: web: java -jar caminho-para-a-sua-aplicacao/seu-artefato.jar .

    For simplicity, you can set the name of the final artifact in pom of your submodule:

    <build>
        <finalName>seu-artefato</finalName>
        ...
    </build>
    

    Explanation : A Procfile contains a number of process type declarations, each on a new line. Each process type is a statement of a command that is executed when a dyno of this type of process is started. For example, if a web process type is declared, then when a dyno of this type is started, the command associated with the web process type will be executed. This may mean starting a web server, for example. In short, at Procfile you should define the type and how your application should run.

    More information can be seen on Heroku's page :

        
    09.05.2017 / 02:28