jhipster 笔记(二):打包与实体

作者:LoveEmperor-王子様
官网:https://www.jhipster.tech/
文档资料地址点击此链接 :

一、项目打包:
1.mvn项目:./mvnw -Pprod clean package
2.gradle项目:gradle bootRepackage -Pprod
3.idea打包:mvn—package
二、运行已打war包:java -jar target/*.war

三、1.导入实体文件:jhipster import-jdl ./my-jdl-file.jdl
2.单独新建实体:jhipster entity <entityName>
3.更新:yo jhipster:entity 需要修改的实体名
具体见文档
四、git-commit-id-plugin报错:

  [ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:2.2.4:rev
  ision (default) on project invoiceproject: Execution default of goal pl.project1
  3.maven:git-commit-id-plugin:2.2.4:revision failed: Unable to load the mojo 'rev
  ision' in the plugin 'pl.project13.maven:git-commit-id-plugin:2.2.4'. A required
  class is missing: com/google/common/base/Function

解决示例:

修改`git-commit-id-plugin`版本,可能当前集成的版本兼容不好,修改为可以版本

     <groupId>pl.project13.maven</groupId>
       <artifactId>git-commit-id-plugin</artifactId>
     <version>2.1.15</version>

五、liquibase数据库升级

1. Database updates with the Maven liquibase:diff goal:       ./mvnw liquibase:diff
Modify your JPA entity (add a field, a relationship, etc.)
Compile your application (this works on the compiled Java code, so don’t forget to compile!)
Run ./mvnw liquibase:diff (or ./mvnw compile liquibase:diff to compile before)
A new “change logis created in your src/main/resources/config/liquibase/changelog directory
Review this change log and add it to your src/main/resources/config/liquibase/master.xml file, so it is applied the next time you run your application

2.使用Maven liquibase:diff更新数据库 ./mvnw liquibase:diff
3.问题:

2018-07-14 11:50:09.898 ERROR 9344 --- [eapp-Executor-1] i.g.j.c.liquibase.Async
SpringLiquibase   : Liquibase could not start correctly, your database is NOT re
ady: Validation Failed:
     1 change sets check sum
          config/liquibase/changelog/20180711041324_added_entity_FGLFpDetails.xm
l::20180711041324-1::jhipster was: 7:da92801ba8e00dea5ecc3b97d1132a29 but is now
: 7:bce6e1175a926a4f28d32d87c444b4c6

处理:

./mvnw liquibase:clearCheckSums

4.问题:

default-cli) on project singleapp: Error setting up or running Liquibase: liquib
ase.exception.DatabaseException: java.sql.SQLException: Access denied for user '
root'@'localhost' (using password: NO) -> [Help 1]

处理:升级没有配置数据库地址等,原为空,修改参照下

  <configuration>
           <changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
                    <diffChangeLogFile>src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
            <driver>com.mysql.jdbc.Driver</driver>
            <url>jdbc:mysql://localhost:3306/singleapp</url>
            <defaultSchemaName>singleapp</defaultSchemaName>
            <username>root</username>
            <password>123456</password>
            <referenceUrl>hibernate:spring:com.xwz.myjhipster.domain?dialect=org.hibernate.dialect.MySQL5InnoDBDialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
            <verbose>true</verbose>
            <logging>debug</logging>
</configuration>

六、很难排查问题:
1.这里写图片描述
VO与DTO的set 与get方法报错:
原因:用了lombok,怎么处理待后续;这里推荐屏蔽lombok,写setget方法
2.另一种是maven-compiler-plugin插件版本有问题

jhipster交流qq群:620456599

猜你喜欢

转载自blog.csdn.net/qq_31424825/article/details/81384912
今日推荐