2016-08-16 129 views
0

刚刚从grails 2.3.11升级到3.2.0.M2 dbm-gorm-diff和其他dbm- *脚本有问题 我的应用程序有多项目结构。域类放置在单独的插件中。Grails 3 db迁移

的build.gradle

buildscript { 
repositories { 
    mavenLocal() 
    maven { url "https://repo.grails.org/grails/core" } 
} 
dependencies { 
    classpath "org.grails:grails-gradle-plugin:$grailsVersion" 
    classpath "org.grails.plugins:hibernate5:6.0.0.M2" 
    classpath "org.grails.plugins:database-migration:2.0.0.RC4" 
} 

}

version "0.1" 
group "core" 

apply plugin:"eclipse" 
apply plugin:"idea" 
apply plugin:"org.grails.grails-plugin" 
apply plugin:"org.grails.grails-plugin-publish" 


configurations.all { 
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds' 
} 

repositories { 
    mavenLocal() 
    maven { url "https://repo.grails.org/grails/core" } 
} 

dependencyManagement { 
    imports { 
     mavenBom "org.grails:grails-bom:$grailsVersion" 
    } 
    applyMavenExclusions false 
} 

dependencies { 
    compile "org.springframework.boot:spring-boot-starter-logging" 
    compile "org.springframework.boot:spring-boot-autoconfigure" 
    compile "org.grails:grails-core" 
    compile "org.grails:grails-dependencies" 
    compile "org.grails.plugins:hibernate5" 
    compile "org.grails.plugins:cache" 
    compile "org.hibernate:hibernate-core:5.1.0.Final" 
    compile "org.hibernate:hibernate-ehcache:5.1.0.Final" 
    console "org.grails:grails-console" 
    profile "org.grails.profiles:plugin:3.2.0.M2" 
    provided "org.grails:grails-plugin-services" 
    provided "org.grails:grails-plugin-domain-class" 
    provided 'javax.servlet:javax.servlet-api:3.1.0' 
    runtime "org.grails.plugins:database-migration:2.0.0.RC4" 
    runtime "mysql:mysql-connector-java:5.1.39" 

    testCompile "org.grails:grails-plugin-testing" 
} 

grailsPublish { 
    // TODO: Provide values here 
    user = 'user' 
    key = 'key' 
    githubSlug = 'app/core' 
    license { 
     name = 'Apache-2.0' 
    } 
    title = "Core" 
    desc = "***" 
    developers = ["***"] 
    portalUser = "" 
    portalPassword = ""  
} 

sourceSets { 
    main { 
     resources { 
      srcDir "grails-app/migrations" 
     } 
    } 
} 

application.yml

grails: 
    profile: plugin 
    codegen: 
    defaultPackage: core 
    spring: 
    transactionManagement: 
     proxies: false 
info: 
    app: 
    name: '@[email protected]' 
    version: '@[email protected]' 
    grailsVersion: '@[email protected]' 
spring: 
    groovy: 
    template: 
     check-template-location: false 
--- 
grails: 
    plugin: 
    databasemigration: 
     updateOnStart: true 
     updateOnStartFileNames: 
     - changelog.groovy 
     - changelog-part-2.groovy 
hibernate: 
    cache: 
    queries: false 
    use_second_level_cache: true 
    use_query_cache: false 
    region.factory_class: 'org.hibernate.cache.ehcache.EhCacheRegionFactory' 

dataSource: 
    dbCreate: none 
    driverClassName: "com.mysql.jdbc.Driver" 
    dialect: "org.hibernate.dialect.MySQL5InnoDBDialect" 
    url: "jdbc:mysql://localhost:3306/project?zeroDateTimeBehavior=convertToNull&autoreconnect=true&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8" 
    username: "root" 
    password: "root" 
    properties: 
    jmxEnabled: true 
    initialSize: 5 
    maxActive: 50 
    minIdle: 5 
    maxIdle: 25 
    maxWait: 10000 
    maxAge: 600000 
    timeBetweenEvictionRunsMillis: 5000 
    minEvictableIdleTimeMillis: 60000 
    validationQuery: SELECT 1 
    validationQueryTimeout: 3 
    validationInterval: 15000 
    testOnBorrow: true 
    testWhileIdle: true 
    testOnReturn: false 
    jdbcInterceptors: ConnectionState 
    defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED 

堆栈跟踪

2016-08-16 18:57:06.731 WARN 5736 --- [   main] o.s.mock.web.MockServletContext   : Couldn't determine real path of resource class path resource [src/main/webapp/WEB-INF/sitemesh.xml] 

java.io.FileNotFoundException: class path resource [src/main/webapp/WEB-INF/sitemesh.xml] cannot be resolved to URL because it does not exist 
    at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:187) ~[spring-core-4.3.1.RELEASE.jar:4.3.1.RELEASE] 
    at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:48) ~[spring-core-4.3.1.RELEASE.jar:4.3.1.RELEASE] 
    at org.springframework.mock.web.MockServletContext.getRealPath(MockServletContext.java:458) ~[spring-test-4.3.1.RELEASE.jar:4.3.1.RELEASE] 
    at org.grails.web.sitemesh.Grails5535Factory.<init>(Grails5535Factory.java:78) [grails-web-sitemesh-3.2.0.M2.jar:3.2.0.M2] 
    at org.grails.web.servlet.view.SitemeshLayoutViewResolver.loadSitemeshConfig(SitemeshLayoutViewResolver.java:105) [grails-web-gsp-3.2.0.M2.jar:3.2.0.M2] 
    at org.grails.web.servlet.view.SitemeshLayoutViewResolver.init(SitemeshLayoutViewResolver.java:67) [grails-web-gsp-3.2.0.M2.jar:3.2.0.M2] 
    at org.grails.web.servlet.view.SitemeshLayoutViewResolver.onApplicationEvent(SitemeshLayoutViewResolver.java:146) [grails-web-gsp-3.2.0.M2.jar:3.2.0.M2] 
    at org.grails.web.servlet.view.SitemeshLayoutViewResolver.onApplicationEvent(SitemeshLayoutViewResolver.java:42) [grails-web-gsp-3.2.0.M2.jar:3.2.0.M2] 
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166) [spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] 
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138) [spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:382) [spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336) [spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:877) [spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) [spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1] 
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1] 
    at grails.boot.GrailsApp.run(GrailsApp.groovy:55) [grails-core-3.2.0.M2.jar:3.2.0.M2] 
    at grails.ui.command.GrailsApplicationContextCommandRunner.run(GrailsApplicationContextCommandRunner.groovy:55) [grails-console-3.2.0.M2.jar:3.2.0.M2] 
    at grails.ui.command.GrailsApplicationContextCommandRunner.main(GrailsApplicationContextCommandRunner.groovy:102) [grails-console-3.2.0.M2.jar:3.2.0.M2] 
    2016-08-16 18:57:07.035 INFO 5736 --- [   main] .c.GrailsApplicationContextCommandRunner : Started GrailsApplicationContextCommandRunner in 21.719 seconds (JVM running for 23.484) 
2016-08-16 18:57:07.035 INFO 5736 --- [   main] grails.boot.GrailsApp     : Application starting in environment: development 
Command execution error: Bean named 'sessionFactory' must be of type [org.springframework.beans.factory.FactoryBean], but was actually of type [org.hibernate.internal.SessionFactoryImpl] 
2016-08-16 18:57:07.185 INFO 5736 --- [  Thread-7] g.u.s.DevelopmentWebApplicationContext : Closing [email protected]: startup date [Tue Aug 16 18:56:48 MSK 2016]; root of context hierarchy 
2016-08-16 18:57:07.382 INFO 5736 --- [  Thread-7] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase -2147483648 
2016-08-16 18:57:07.406 INFO 5736 --- [  Thread-7] o.s.j.e.a.AnnotationMBeanExporter  : Unregistering JMX-exposed beans on shutdown 

你能帮我吗?

回答