2017-02-07 5 views
0

flyway 및 gradle을 사용하여 데이터베이스 마이그레이션을 설정하려고했습니다.Gradle flywayMigrate에서 메모리 부족 예외가 발생했습니다.

cat ~/.gradle/gradle.properties 
org.gradle.parallel=true 
org.gradle.daemon=true 
org.gradle.jvmargs=-Xms1024m -Xmx2048m 

도움이되지 않았다, 어떤 제안하십시오 :이 작업은 내가 너무 Gradle을 속성에 다음

echo $GRADLE_OPTS 
-Xmx2048m 

echo $JAVA_OPTS 
-Xmx2048m 

추가 된 일부 설정을하려고 다음과 같은 오류

* Exception is: 
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':flywayMigrate'. 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84) 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55) 
     at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:61) 
     at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) 
     at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88) 
     at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:45) 
     at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51) 
     at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) 
     at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) 
     at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) 
     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:233) 
     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215) 
     at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:74) 
     at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:55) 
     at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) 
     at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) 
Caused by: java.lang.OutOfMemoryError: Java heap space 
     at org.flywaydb.core.internal.util.FileCopyUtils.copy(FileCopyUtils.java:117) 
     at org.flywaydb.core.internal.util.FileCopyUtils.copyToByteArray(FileCopyUtils.java:68) 
     at org.flywaydb.core.internal.util.scanner.classpath.ClassPathResource.loadAsBytes(ClassPathResource.java:100) 
     at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.extractMigrationInfo(SqlMigrationResolver.java:140) 
     at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.resolveMigrations(SqlMigrationResolver.java:112) 
     at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.resolveMigrations(SqlMigrationResolver.java:41) 
     at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.collectMigrations(CompositeMigrationResolver.java:126) 
     at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.doFindAvailableMigrations(CompositeMigrationResolver.java:108) 
     at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:94) 
     at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:42) 
     at org.flywaydb.core.internal.info.MigrationInfoServiceImpl.refresh(MigrationInfoServiceImpl.java:96) 
     at org.flywaydb.core.internal.command.DbValidate$2.doInTransaction(DbValidate.java:136) 
     at org.flywaydb.core.internal.command.DbValidate$2.doInTransaction(DbValidate.java:131) 
     at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72) 
     at org.flywaydb.core.internal.command.DbValidate.validate(DbValidate.java:131) 
     at org.flywaydb.core.Flyway.doValidate(Flyway.java:1014) 
     at org.flywaydb.core.Flyway.access$300(Flyway.java:52) 
     at org.flywaydb.core.Flyway$1.execute(Flyway.java:925) 
     at org.flywaydb.core.Flyway$1.execute(Flyway.java:919) 
     at org.flywaydb.core.Flyway.execute(Flyway.java:1320) 
     at org.flywaydb.core.Flyway.migrate(Flyway.java:919) 
     at org.flywaydb.core.Flyway$migrate$0.call(Unknown Source) 
     at org.flywaydb.gradle.task.FlywayMigrateTask.run(FlywayMigrateTask.groovy:30) 
     at org.flywaydb.gradle.task.FlywayMigrateTask$run.callCurrent(Unknown Source) 
     at org.flywaydb.gradle.task.AbstractFlywayTask.runTask(AbstractFlywayTask.groovy:75) 

실패?

답변

0
buildscript { 
    dependencies { 
     classpath 'mysql:mysql-connector-java:5.1.34' 
    } 
} 


plugins { 
    id "org.flywaydb.flyway" version "4.0.3" 
} 

flyway { 
    url = 'jdbc:mysql://localhost:3306/mydb' 
    user = 'root' 
    password = 'abc!23' 
    schemas = ['mydb'] 
    baselineVersion = 1 
    baselineDescription = "Baselining myDB Schema" 
} 

기본적으로 나는 매우 오래된 버전의 FlyWay를 사용하여 Java 힙 공간 - My Bad가 발생했습니다. 위의 빌드 스크립트는 MYSQL에서 FlyWay를 사용하여 DB 마이그레이션을 수행하려는 모든 사용자를위한 리소스가 될 수 있습니다.