generator-jhipster: liquibase-maven-plugin fails whith liquibase:diff in fresh generated jhipster 7.9.2 project

When I run in a fresh installed jhipster 7.9.2 project:

./mvnw liquibase:diff compile                            
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------< de.bitc.jhipster:jhipster-test >-------------------
[INFO] Building Jhipster Test 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- liquibase-maven-plugin:4.12.0:diff (default-cli) @ jhipster-test ---
[WARNING] The POM for org.liquibase:liquibase-test-harness:jar:1.0.5 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.461 s
[INFO] Finished at: 2022-08-23T19:26:38+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] version can neither be null, empty nor blank
[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.

it fails.

Motivation for or Use Case

I used the liquibase diff feature often in older versions without problems. It generate automatic the liquibase xml files.

Reproduce the error

Generate an new project or check out my test project and run ./mvnw liquibase:diff compile

Related issues
Suggest a Fix
JHipster Version(s)
jhipster-test@0.0.1-SNAPSHOT /home/buchholz/project/private/jhipster/jhipster-test
└── generator-jhipster@7.9.2

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationIndex": 0,
    "applicationType": "monolith",
    "authenticationType": "oauth2",
    "baseName": "jhipsterTest",
    "blueprints": [],
    "buildTool": "maven",
    "cacheProvider": "ehcache",
    "clientFramework": "angularX",
    "clientPackageManager": "npm",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1659782029370,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "devServerPort": 4200,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": true,
    "entities": ["Region", "Country", "Location", "Department", "Task", "Employee", "Job", "JobHistory"],
    "entitySuffix": "",
    "gradleEnterpriseHost": "",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.9.2",
    "languages": ["en"],
    "lastLiquibaseTimestamp": 1659782509000,
    "messageBroker": false,
    "nativeLanguage": "en",
    "otherModules": [],
    "packageFolder": "de/bitc/jhipster",
    "packageName": "de.bitc.jhipster",
    "pages": [],
    "prodDatabaseType": "postgresql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": "8080",
    "serviceDiscoveryType": false,
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "skipUserManagement": true,
    "testFrameworks": [],
    "websocket": false,
    "withAdminUi": true
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity Region {
  regionName String
}
entity Country {
  countryName String
}
/**
 * not an ignored comment
 */
entity Location {
  streetAddress String
  postalCode String
  city String
  stateProvince String
}
entity Department {
  departmentName String required
}
/**
 * Task entity.\n@author The JHipster team.
 */
entity Task {
  title String
  description String
}
/**
 * The Employee entity.
 */
entity Employee {
  /**
   * The firstname attribute.
   */
  firstName String
  lastName String
  email String
  phoneNumber String
  hireDate Instant
  salary Long
  commissionPct Long
}
entity Job {
  jobTitle String
  minSalary Long
  maxSalary Long
}
entity JobHistory {
  startDate Instant
  endDate Instant
  language Language
}
enum Language {
  FRENCH,
  ENGLISH,
  SPANISH
}

relationship OneToOne {
  Country{region} to Region
  Location{country} to Country
  Department{location} to Location
  JobHistory{job} to Job
  JobHistory{department} to Department
  JobHistory{employee} to Employee
}
relationship OneToMany {
  /**
   * A relationship
   */
  Department{employee} to
  /**
   * Another side of the same relationship
   */
  Employee{department}
  Employee{job} to Job{employee}
}
relationship ManyToOne {
  Employee{manager} to Employee
}
relationship ManyToMany {
  Job{task(title)} to Task{job}
}

service Region, Country, Location, Department, Task, JobHistory with serviceImpl
paginate Employee, JobHistory with infinite-scroll
paginate Job with pagination

Environment and Tools

openjdk version “11.0.15” 2022-04-19 OpenJDK Runtime Environment 11.0.15_p10-r1 (build 11.0.15+10) OpenJDK 64-Bit Server VM 11.0.15_p10-r1 (build 11.0.15+10, mixed mode, sharing)

git version 2.35.1

node: v18.6.0

npm: 8.13.2

Docker version 20.10.12, build e91ed5707e

docker-compose version 1.29.2, build unknown

No change to package.json was detected. No package manager install will be executed. Congratulations, JHipster execution is complete!

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • [ x] Checking this box is mandatory (this is just to show you read everything)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Hi guys, am using version 7.9.3 and I was experiencing the same issue

I solved the issue by adding the version of h2 under the plugin dependencies as follows

<plugin>
      <groupId>org.liquibase</groupId>
      <artifactId>liquibase-maven-plugin</artifactId>
      <version>${liquibase.version}</version>
      <configuration>
          ...
      </configuration>
      <dependencies>
          <dependency>
              <groupId>org.liquibase</groupId>
              <artifactId>liquibase-core</artifactId>
              <version>${liquibase.version}</version>
          </dependency>
          <dependency>
              <groupId>org.liquibase.ext</groupId>
              <artifactId>liquibase-hibernate5</artifactId>
              <version>${liquibase-hibernate5.version}</version>
          </dependency>
          <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-data-jpa</artifactId>
              <version>${spring-boot.version}</version>
          </dependency>
          <dependency>
              <groupId>javax.validation</groupId>
              <artifactId>validation-api</artifactId>
              <version>${validation-api.version}</version>
          </dependency>
          <dependency>
              <groupId>com.h2database</groupId>
              <artifactId>h2</artifactId>
              <version>2.1.214</version>   <----------------------
          </dependency>
      </dependencies>
  </plugin>

enjoy 😃

Hurray ! Solved part of the problem :

As the error message specifies that the “version can neither be null, empty nor blank”, I added the version in the pom and it works 👍

<dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>2.1.214</version>
</dependency>

Now I have an other problem : The H2 database must be running. And If running by “./mvnw” in a terminal, appears another problem :

[ERROR] liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:h2:file:C:\blabla\IdeaProjects\esbportal\target/h2d b/db/esbportal with driver org.h2.Driver. Make sure your H2 database is active and accessible by opening a new terminal window, run “liquibase init start-h2”, and then return to this terminal window to run commands.

So I’m near the solution…

@mshima Yes, I plan to create a PR, after addressing the Gradle issue first 😅.