jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.5k stars 4.02k forks source link

Running ./mvnw results in a Compliation Error: "config/PostgreSqlTestContainer.java:[7,37] cannot find symbol" #21782

Closed shaneparkinson closed 8 months ago

shaneparkinson commented 1 year ago
Overview of the issue

When running the project for the first time using ./nvnm, a compilation error results for the maven goal default-testcomplie

--- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) @ blog ---

The result is a 'PostgreSqlTestContainer.java:[7,37] cannot find symbol' compilation error (shown below).

The compilation error results in jHipster not starting.

I then followed the setup steps provided in the following video

Matt Raible created a screencast that shows how to use JHipster 7 to develop a Spring Boot + Angular application.

The application error is not present, and jHipster is started successfully. The only difference between the two configurations that I made was to use a VUE frontend instead of the default Angular, add Gatling to the testing frameworks and have cacheProvider = "no". I'm not sure why with different settings, I'm getting a test compile error with my jHipster configuration and using the defaults on the same machine compiles successfully.

[INFO]
[INFO] --- jacoco-maven-plugin:0.8.8:prepare-agent (pre-unit-tests) @ blog ---
[INFO] argLine set to -javaagent:/Users/xx/.m2/repository/org/jacoco/org.jacoco.agent/0.8.8/org.jacoco.agent-0.8.8-runtime.jar=destfile=/Users/xx/Projects/blog/target/jacoco.exec -Djava.security.egd=file:/dev/./urandom -Xmx1G
[INFO] 
[INFO] --- properties-maven-plugin:1.1.0:read-project-properties (default) @ blog ---
[INFO] 
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ blog ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.3.0:testResources (default-testResources) @ blog ---
[INFO] Copying 13 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) @ blog ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 26 source files to /Users/xx/Projects/blog/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/xx/Projects/blog/src/test/java/com/xx/config/PostgreSqlTestContainer.java:[7,37] cannot find symbol
  symbol:   class PostgreSQLContainer
  location: package org.testcontainers.containers
[ERROR] /Users/xx/Projects/blog/src/test/java/com/xx/config/PostgreSqlTestContainer.java:[14,13] cannot find symbol
  symbol:   class PostgreSQLContainer
  location: class com.xx.config.PostgreSqlTestContainer
[INFO] 2 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.464 s
[INFO] Finished at: 2023-04-11T15:48:29+10:00
[INFO] ------------------------------------------------------------------------
Motivation for or Use Case

I'm trying to learn Java and spring using JHipster so I'm not sure why this error is happening

Reproduce the error

The error is happening with each execution of ./mvnw and I can't get the application to start

Related issues

Related Issue: https://github.com/jhipster/generator-jhipster/issues/21701

Suggest a Fix
JHipster Version(s)
INFO! Switching to JHipster installed locally in the current project's node repository (node_modules)
INFO! Using bundled JHipster
7.9.3
JHipster configuration

{ "generator-jhipster": { "applicationType": "monolith", "authenticationType": "jwt", "baseName": "blog", "blueprints": [], "buildTool": "maven", "cacheProvider": "no", "clientFramework": "vue", "clientPackageManager": "npm", "clientTheme": "none", "clientThemeVariant": "", "creationTimestamp": 1681189559467, "cypressAudit": true, "cypressCoverage": null, "databaseType": "sql", "devDatabaseType": "h2Disk", "devServerPort": 9060, "dtoSuffix": "DTO", "enableGradleEnterprise": false, "enableHibernateCache": false, "enableSwaggerCodegen": false, "enableTranslation": false, "entitySuffix": "", "jhiPrefix": "jhi", "jhipsterVersion": "7.9.3", "jwtSecretKey": "", "languages": ["en", "fr"], "messageBroker": false, "microfrontend": false, "microfrontends": [], "nativeLanguage": "en", "otherModules": [], "packageName": "com.xx", "pages": [], "prodDatabaseType": "postgresql", "reactive": true, "searchEngine": false, "serverPort": "8080", "serverSideOptions": [], "serviceDiscoveryType": "eureka", "skipCheckLengthOfIdentifier": false, "skipClient": false, "skipFakeData": false, "skipUserManagement": false, "testFrameworks": ["cypress", "gatling"], "websocket": false, "withAdminUi": true } }

Entity configuration(s) entityName.json files generated in the .jhipster directory

No Entities have been generated. This is the first run of jHipster after typing jHipster in the console and answering all the questions it generates.

Browsers and Operating System

Mac OSX - Ventura - 13.3.1 (22E261) Browser: Chrome Version 111.0.5563.146 (Official Build) (arm64) Java controlled by jenv set to global OpenJDK 11.0.11

java --version
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
mraible commented 1 year ago

Possibly related: https://github.com/jhipster/generator-jhipster/issues/21853

github-actions[bot] commented 8 months ago

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days