2
votes

Context: I have a jhipster project for whom I installed some jhipster modules (yeoman generators) that should behave as post-entity hooks. One of the jhipster modules is not created by me, it is actually jhipster-entity-audit. I first ran yo jhipster-entity-audit, which succedeed and created the .jhipster\modules\jhi-hooks.json file.

Problem: When I run the jdl importer, as new entities are being created, I am expecting to see jhipster-entity-audit executing for each newly create entity as it should behave as a post entity hook. Instead, I am receiving this output:

enter image description here

Mentions: I surely do have jhipster-entity-audit generator installed. I tried installing it through many methods, with Yarn/Node (local and/or global).

I would really appreciate some suggestions about how to solve this issue, and also, optional questions if I have not succeeded to provide all the information needed for you to be able to help me.

1
It looks like you have found a bug. What would help is a minimal project available on github that reproduces the problem. Once you have it you can open an issue on github against jhipster-entity-audit with a link to this project repository and output of jhipster info because your question does not tell which version you're using for jhipster, node, etc.... Then you can probably delete this question as it won't be answered. - Gaël Marziou
Thank you for your suggestion. I'll follow the suggested steps, but I do not think that there is a bug in jhipster-entity-audit, as the other generator created by me and configured as a hook outputs the same error. Could not compose module <my_generator_name> If there is a bug and not a mistake of mine, i think that it is not a specific to one generator, but to a larger range. I'll post a link to the repo, when i create it. - ancab
OK it's a very good point, so it's probably an issue in generator-jhipster - Gaël Marziou

1 Answers

2
votes

answer : this is not a bug, it's not supported yet.

You may use it in several steps though :

  1. yo jhipster
  2. yo jhipster:import-jdl
  3. yo jhipster-entity-audit
  4. yo jhipster:entity EntityName
  5. Repeat step 4 for each entity (and probably in the correct order, I don't remember the requirement of this module)...

details : jhipster:import-jdl doesn't support post hook for the moment. It's not as simple as it running several times the entity generator and his hook. The context is not the same.

You'll have to wait until it does.

I have similar problems with the module I coded : https://github.com/bastienmichaux/generator-jhipster-db-helper/issues/46

I intend to solve this problem by calling the entity generator myself but it is because my module has a similar function as the jdl importer. And when I'll have done so, we'll see how we can integrate it into the jdl importer. So we're talking about 2 months or something like that.