I decided to write a simple bot for telegrams and put it on Heroka. I don’t really understand why the Procfile file isn’t added. It’s not in the jar or in the file lists. In IntelliJ I create a new file in the folder with classes, call it Procfile (without permission), I write the following there:

worker: sh target/bin/TGBot 

My pom.xm:

 <?xml version="1.0" encoding="UTF-8"?> 

http://maven.apache.org/xsd/maven-4.0.0.xsd "> 4.0.0

 <groupId>TelegramTestBot</groupId> <artifactId>Bot</artifactId> <version>1.0-SNAPSHOT</version> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>7</source> <target>7</target> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>appassembler-maven-plugin</artifactId> <version>1.1.1</version> <configuration> <assembleDirectory>target</assembleDirectory> <programs> <program> <mainClass>Bot</mainClass> <name>TGBot</name> </program> </programs> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>assemble</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.telegram</groupId> <artifactId>telegrambots</artifactId> <version>3.6</version> </dependency> </dependencies> 

Assembling is carried out using the mvn clean install command. Or do I worry in vain and it miraculously picks up this Procfile itself?

    2 answers 2

    You need to put the Procfile in the root of the project (near pom.xml). And insert the start command there, like this:

     web: java -Dserver.port=$PORT -jar target/project-name-1.0.jar 

    After that you need to make a jar file with the command:

     mvn clean package 

    It will create your * .jar file in the target.

    After that, if you created a project in heroku and logged in, then you need to run the command:

     git push heroku master 

    And you have everything. You can check logs with the command

     heroku logs -t 

      By account entries in Procfile

       web: java -Dserver.port=$PORT -jar target/project-name-1.0.jar 

      As understood, it depends on how the bot works through Webhook or Long Polling and in the latter case the type of process should be: worker.