Spring找不到Procfile(Windows)

时间:2018-01-02 02:35:59

标签: spring-boot spring-data spring-data-jpa heroku-postgres heroku-cli

我正在尝试通过Heroku在Spring Tool Suite(windows)上部署我的项目。我遵循了Heroku的指示:https://devcenter.heroku.com/articles/deploying-spring-boot-apps-to-heroku 但它仍然不起作用:https://invoicepaymentapp.herokuapp.com/

这是日志信息:

ValueError: time data '13 Aug 05' does not match format '%d %m %y'

我将我的项目推送到github:https://github.com/rodCurvelo/paymentapp

我通过以下方式创建了一个heroku应用程序:

2018-01-02T01:15:58.569490+00:00 heroku[web.1]: Starting process with command 
`java -Dserver.port=40785 -jar target/paymmentApp-0.0.1-SNAPSHOT.jar`
2018-01-02T01:16:01.342101+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS 
defaults based on dyno size. Custom settings will override them.
2018-01-02T01:16:01.343156+00:00 app[web.1]: Error: Unable to access jarfile 
target/paymmentApp-0.0.1-SNAPSHOT.jar
2018-01-02T01:16:01.481789+00:00 heroku[web.1]: State changed from starting 
to crashed
2018-01-02T01:16:01.466643+00:00 heroku[web.1]: Process exited with status 1
2018-01-02T01:22:34.997753+00:00 heroku[router]: at=error code=H10 desc="App 
crashed" method=GET path="/" host=invoicepaymentapp.herokuapp.com 
request_id=a7723424-478b-42c0-aa50-96d0fea721c9 fwd="24.27.72.43" dyno= 
connect= service= status=503 bytes= protocol=https
2018-01-02T01:22:35.206610+00:00 heroku[router]: at=error code=H10 desc="App 
crashed" method=GET path="/favicon.ico" host=invoicepaymentapp.herokuapp.com 
request_id=61fa5e70-e1a1-444c-9d1f-9a6660c7a010 fwd="24.27.72.43" dyno= 
connect= service= status=503 bytes= protocol=https
2018-01-02T01:52:05.143835+00:00 heroku[router]: at=error code=H10 desc="App 
crashed" method=GET path="/" host=invoicepaymentapp.herokuapp.com 
request_id=2d5cf43c-bf17-48e9-a66c-eb5822534ec1 fwd="24.27.72.43" dyno= 
connect= service= status=503 bytes= protocol=https
2018-01-02T01:52:11.093114+00:00 heroku[router]: at=error code=H10 desc="App 
crashed" method=GET path="/favicon.ico" host=invoicepaymentapp.herokuapp.com 
request_id=1ec5eeb6-abb6-4036-9b7d-6d66089e7d3f fwd="24.27.72.43" dyno= 
connect= service= status=503 bytes= protocol=https
2018-01-02T01:53:13.985380+00:00 heroku[router]: at=error code=H10 desc="App 
crashed" method=GET path="/favicon.ico" host=invoicepaymentapp.herokuapp.com 
request_id=e3cd1194-7644-4994-b553-bdc117a4448d fwd="24.27.72.43" dyno= 
connect= service= status=503 bytes= protocol=https
2018-01-02T01:53:13.695494+00:00 heroku[router]: at=error code=H10 desc="App 
crashed" method=GET path="/" host=invoicepaymentapp.herokuapp.com 
request_id=47be7a2f-71cb-4b22-8cd3-033b0ac56d43 fwd="24.27.72.43" dyno= 
connect= service= status=503 bytes= protocol=https

我尝试按照Procfile.windows的说明进行操作:Exception deploying Spring Boot app locally with Heroku

但我认为我的项目中的pom.xml,Procfile或application.properties文件有问题:

$heroku create invoicepaymentapp 

Procfile:

<?xml version="1.0" encoding="UTF-8"?>
            <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.jacana</groupId>
                <artifactId>paymmentApp</artifactId>
                <version>0.0.1-SNAPSHOT</version>

                <name>paymmentApp </name>
                <description>Demo project for Spring Boot</description>

                <parent>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-parent</artifactId>
                    <version>1.5.9.RELEASE</version>
                    <relativePath/> <!-- lookup parent from repository -->
                </parent>

                <properties>
                    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
                    <java.version>1.8</java.version>
                </properties>

                <dependencies>
                    <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-data-jpa</artifactId>
                    </dependency>
                    <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-thymeleaf</artifactId>
                    </dependency>
                    <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-web</artifactId>
                    </dependency>

                    <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-tomcat</artifactId>
                        <scope>provided</scope>
                    </dependency>

            <!--         <dependency> 
                        <groupId>mysql</groupId> 
                        <artifactId>mysql-connector-java</artifactId> 
                    </dependency>  --> 


                    <dependency>
                        <groupId>org.postgresql</groupId>
                        <artifactId>postgresql</artifactId>
                        <version>9.4-1201-jdbc4</version>
                    </dependency>  


                    <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-test</artifactId>
                        <scope>test</scope>
                    </dependency>

                    <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-devtools</artifactId>
                    </dependency>

                </dependencies>

                <build>
                    <finalName>${project.artifactId}</finalName>
                    <plugins>
                        <plugin>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-maven-plugin</artifactId>
                        </plugin>
                    </plugins>
                </build>


            </project>

application.properties:

web: java -Dserver.port=$PORT -jar target/paymmentApp-0.0.1-SNAPSHOT.jar

(基于我的heroku数据库帐户的用户,密码等)

我按照Procfile.windows的说明操作,但它对我不起作用: Exception deploying Spring Boot app locally with Heroku

1 个答案:

答案 0 :(得分:0)

您在 pom.xml 中添加了<finalName>${project.artifactId}</finalName> - 这告诉maven生成jar文件名,例如project.artifactId - paymmentApp.jar 。所以:

1)从pom.xml中删除<finalName>${project.artifactId}</finalName>

2)或编辑您的Procfile:web: java -Dserver.port=$PORT -jar target/paymmentApp.jar

3)或者像这样:web: java -Dserver.port=$PORT -jar target/*.jar