Travis-CI中的集成错误

时间:2018-08-03 15:59:10

标签: hibernate spring-boot travis-ci

这是错误日志:

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 10.01 s <<< FAILURE! - in com.rjdesenvolvimento.apipessoas.ApipessoasApplicationTests
[ERROR] contextLoads(com.rjdesenvolvimento.apipessoas.ApipessoasApplicationTests)  Time elapsed: 0.019 s  <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
Caused by: org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
Caused by: org.postgresql.util.PSQLException: FATAL: database "aries" does not exist

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   ApipessoasApplicationTests.contextLoads » IllegalState Failed to 
load Applicat...
[INFO] 
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] 
[INFO] --------------------------------------------------------------------- 
---
[INFO] BUILD FAILURE
[INFO] ---------------------------------------------------------------------- 
--
[INFO] Total time: 19.751 s
[INFO] Finished at: 2018-08-03T03:26:16Z
[INFO] ---------------------------------------------------------------------- 
--
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire- 
plugin:2.21.0:test (default-test) on project apipessoas: There are test 
failures.
[ERROR] 
[ERROR] Please refer to 
/home/travis/build/rodrigodevelms/api_pessoas/target/surefire-reports for the 
individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, 
[date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
The command "./mvnw test -B" exited with 1.
Done. Your build exited with 1.

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

在您的.travis.yml文件中添加此配置

sudo: enabled

addons:
  postgresql: "9.5" // change "9.5" for your postgres specific version

before_script:
  - psql -c "create database aries;" -U postgres // your database name
  - sudo -u postgres psql -c "ALTER ROLE postgres WITH password 'postgres'" // if your password is different from 'postgres` use that one here

services:
  - postgresql

您可以将此.travis.yml作为参考,在此我已经成功设置了它。