jhipster / generator-jhipster-micronaut

Micronaut blueprint for JHipster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error to create a micronaut application

javagrails opened this issue · comments

Error to create an Application using below commands

❯ mhipster OR ❯ jhipster --blueprints micronaut

ERROR! An error occured while running jhipster-micronaut:server#writeFiles
ERROR! ERROR! Template file src/main/java/package/config/dbmigrations/InitialSetupMigration.kt was not found at /Users/salehpc/.nvm/versions/node/v20.9.0/lib/node_modules/generator-jhipster-micronaut/generators/server/templates

Reproduce Environment and Bug Details in Picture

❯ java --version
openjdk 21 2023-09-19
OpenJDK Runtime Environment (build 21+35-2513)
OpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)

❯ node --version
v20.9.0

❯ jhipster --version
8.2.1

❯ npm install -g generator-jhipster-micronaut

❯ mhipster --version
INFO! No custom commands found within blueprint: generator-jhipster-micronaut at /Users/salehpc/.nvm/versions/node/v20.9.0/lib/node_modules/generator-jhipster-micronaut
3.1.0 (generator-jhipster 8.2.1)

mh-prob-01 mh-prob-02

Suggest a Fix

Have to look on any unwanted option aprear in application creation process, as @mraible guessing [Spring WebFlux] may be the problem as it is not Spring app it'a a Micronaut app

Thanks for reporting this issue, @javagrails!

I looked through the codebase for the Quarkus blueprint to see how it suppresses the reactive/Spring WebFlux question, but I couldn't find anything. @mshima Do you know how to drop this question?

I will take a look at the generator-jhipster side.

@mshima It still prompts for the cache abstraction, which I believe should only be part of the main generator.

Screenshot 2024-04-01 at 5 07 23 PM

As for the jhipster-micronaut:server#writeFiles error, that one is strange because it's trying to find a Kotlin file, rather than a Java one.

ERROR! ERROR! Template file src/main/java/package/config/dbmigrations/InitialSetupMigration.kt was not found at /Users/mraible/dev/generator-jhipster-micronaut/generators/server/templates,/Users/mraible/dev/generator-jhipster-micronaut/node_modules/generator-jhipster/dist/generators/server/templates,/Users/mraible/dev/generator-jhipster-micronaut/node_modules/generator-jhipster/dist/generators/spring-data-relational/templates,/Users/mraible/dev/generator-jhipster-micronaut/node_modules/generator-jhipster/dist/generators/java/templates

There is a InitialSetupMigration.java.ejs file at generators/spring-data-mongodb/templates/src/main/java/_package_/config/dbmigrations/InitialSetupMigration.java.ejs.

Mongodb support never got finished.

The README says that NoSQL databases are not supported. How do I eliminate them from the choices? I tried the following, but it doesn't work.

diff --git a/generators/server/command.js b/generators/server/command.js
index 65a8071..0b1f965 100644
--- a/generators/server/command.js
+++ b/generators/server/command.js
@@ -1,7 +1,9 @@
 import { command as serverCommand } from 'generator-jhipster/generators/server';
+import { databaseTypes } from 'generator-jhipster/jdl';
 
-const { applicationType, ...remainingConfigs } = serverCommand.configs;
+const { applicationType, databaseType, ...remainingConfigs } = serverCommand.configs;
 
+const noSQL = [databaseTypes.MONGODB, databaseTypes.CASSANDRA, databaseTypes.COUCHBASE, databaseTypes.NEO4J];
 /**
  * @type {import('generator-jhipster').JHipsterCommandDefinition}
  */
@@ -13,6 +15,11 @@ const command = {
       ...applicationType,
       choices: applicationType.choices.filter(({ value }) => value !== 'gateway'),
     },
+    // NoSQL is not supported
+    databaseType: {
+      ...databaseType,
+      choices: databaseTypes.choices.filter(({ value }) => !noSQL.includes(value)),
+    },
     ...remainingConfigs,
   },
   override: true,

Not every option has been migrated to new config.

Fixed by #331.