Deploy Heroku Maven project with multiple modules

Asked

Viewed 157 times

1

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

Doubts:

  1. Where should get the Procfile? In the packaging project or in the web project?

  2. Like should get the 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>

1 answer

0

Your Procfile should be in the root of the project, ie in the same directory as your package project is.

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

To simplify you can define in pom of its submodule the name of the final artifact:

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

Explanation: A Procfile contains a number of process type declarations, each in a new row. Each type of process is a statement of a command that is executed when a Dyno of this type of process is started. For example, if a process type web is declared, so when a Dyno of this type is started, the command associated with the web process type will be executed. This can mean starting a web server, for example. In short, in your Procfile you must define the type and how your application should be executed.

More information can be seen on page of Heroku:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.