jhipster / generator-jhipster-quarkus

Quarkus blueprint for JHipster
https://www.jhipster.tech/blueprints/quarkus/
Apache License 2.0
141 stars 56 forks source link

Error when generating new application with internationalization support: Unable to find MailServiceIT.java or missing required jhipster-needle. #113

Closed GeraldScott closed 3 years ago

GeraldScott commented 4 years ago

Describe the bug If support for internationalization support is enabled, the blueprint generates an error after the Git repository has been initialized, as follows:

Unable to find src/test/java/com/taung/scaffold/service/MailServiceIT.java or missing required jhipster-needle. LANGUAGE constant not updated with languages: en,pt-pt since block was not found. Check if you have enabled translation support.

The error occurs when you select one or more languages for internationalization.

To Reproduce Install generator-jhipster and generator-jhipster-quarkus

Generate application:

mkdir test && cd $_
jhipster --blueprints quarkus
? Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)
? Which *production* database would you like to use? PostgreSQL
? Which *development* database would you like to use? H2 with in-memory persistence
? Would you like to use Maven or Gradle for building the backend? Maven
     info Using blueprint generator-jhipster-quarkus for client subgenerator
? Which *Framework* would you like to use for the client? Angular
? Would you like to use a Bootswatch theme (https://bootswatch.com/)? Lux
? Choose a Bootswatch variant navbar theme (https://bootswatch.com/)? Dark
     info Using blueprint generator-jhipster-quarkus for common subgenerator
? Would you like to enable internationalization support? Yes
? Please choose the native language of the application English
? Please choose additional languages to install Dutch, French

Installing languages: en, nl, fr
Git repository initialized.

Unable to find src/test/java/com/taung/test/service/MailServiceIT.java or missing required jhipster-needle. LANGUAGE constant not updated with languages: en,nl,fr since block was not found. Check if you have enabled translation support.

Expected behavior Application should be generated without error messages.

Version JHipster: 6.10.1 jhipster-quarkus 0.1.6

.yo-rc.json

{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.taung.test",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "6.8.0",
    "applicationType": "monolith",
    "baseName": "test",
    "packageName": "com.taung.test",
    "packageFolder": "com/taung/test",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Memory",
    "prodDatabaseType": "postgresql",
    "messageBroker": false,
    "buildTool": "maven",
    "jwtSecretKey": "ZTExNTE0ZjczN2RiOWIzZjQ3NTc0ZmYxMzUwODMwMjY3ODcyYWFkMzZkMDc2ZmMyOTBkOGJjZjZkNjY2MGEyMGYzZjJkMTA1Y2U3Njk3ZTZiOThlM2I1ZWY3MDVlY2M4NGI1MTJiNjYxYTdmMWU5MmViZTQ5NTM4MmE3MmRmOWY=",
    "embeddableLaunchScript": false,
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "angularX",
    "clientTheme": "lux",
    "clientThemeVariant": "dark",
    "creationTimestamp": 1604644287350,
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [
      {
        "name": "generator-jhipster-quarkus",
        "version": "0.1.6"
      }
    ],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": ["en", "nl", "fr"],
    "blueprints": [
      {
        "name": "generator-jhipster-quarkus",
        "version": "0.1.6"
      }
    ]
  }
}
avdev4j commented 3 years ago

Hi @GeraldScott I can confirme that the message does exist. Let me explain why. This generator is a blueprint, it will be called aside JHipster and override some existing generators. In the meantime, the JHipster generator will continue to do his job where our Blueprint do not.

In this case, the language generator tries to update a MailServiceIT.java file to add the selected languages. Because with Quarkus we did not have added this file, an error message is logged.

For me it's not a blocking problem and I see many ways to fix it:

IMO both first and second options are a bit weird and we should improve our test coverage instead.

avdev4j commented 3 years ago

We should a new class test named MaiServiceIT.java (https://github.com/jhipster/generator-jhipster/blob/main/generators/server/templates/src/test/java/package/service/MailServiceIT.java.ejs).

And it have to contains the needle https://github.com/jhipster/generator-jhipster/blob/main/generators/server/templates/src/test/java/package/service/MailServiceIT.java.ejs#L87