如何在 heroku 上为 java 服务器制作 procfile?

How to make procfile for java server on heroku?

我花了一天时间尝试 运行 java xmpp fcm 服务器 Google Firebase 消息传递。
example 在 Heroku 服务上建立服务器之后,我发现我需要创建 procfile 文件。 Procfile 是:

A Procfile is a mechanism for declaring what commands are run by your application’s dynos on the Heroku platform.

直到现在,我尝试使用如下命令启动它:

web: java -cp target/classes/:target/dependency/* com.wedevol.xmpp.server.CcsClient 

但它不起作用。 $ heroku 日志:

2017-01-31T13:14:50.844896+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=vast-forest-64025.herokuapp.com request_id=a8a8b191-3679-4746-abf3-c7766fbb8764 fwd="141.226.161.218" dyno= connect= service= status=503 bytes=

$ heroku ps returns:

=== web (Free): java -cp target/classes/:target/dependency/* com.wedevol.xmpp.server.CcsClient (1) web.1: crashed 2017/01/31 15:13:08 +0200 (~ 5m ago)

我需要你的帮助。我需要在该文件中定义 运行 成功 Java 服务器(来自上面的 link)。 谢谢!

有关其他信息,原始 POM 文件如下所示:

<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>com.wedevol</groupId>
<artifactId>xmppserver2</artifactId>
<version>0.0.2</version>
<packaging>jar</packaging>

<name>FCM XMPP Server</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <jdk.version>1.7</jdk.version>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.igniterealtime.smack</groupId>
        <artifactId>smack-java7</artifactId>
        <version>4.1.8</version>
    </dependency>
    <dependency>
        <groupId>org.igniterealtime.smack</groupId>
        <artifactId>smack-tcp</artifactId>
        <version>4.1.8</version>
    </dependency>
    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1.1</version>
    </dependency>
</dependencies>

<build>
    <finalName>xmpp-server</finalName>
    <plugins>

        <!-- Set a JDK compiler level -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>

    </plugins>
</build>

经过几个小时的痛苦终于得到了 Java 服务器的正确 Procfile:

web: java -cp target/classes/:target/dependency/* com.wedevol.xmpp.EntryPoint

*上传前不要忘记构建项目:

mvn package