1. 程式人生 > >jhipster 筆記(二):打包與實體

jhipster 筆記(二):打包與實體

一、專案打包:
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