Generator-jhipster: import-jdl does not respect skipUserManagement cli params or jdl settings

Created on 1 Sep 2020  ·  18Comments  ·  Source: jhipster/generator-jhipster

Overview of the issue

The command stacktrace states that skipUserManagement can be used to enable relationships between a custom defined User entity and Company entity, however
JHipster jdl/import-jdl does not accept any form of the setting: neither the command line argument --skip-user-management, nor the alternative specifying // skip-user-management as first line of JDL file work.

According JHipster documentation --skip-user-management should be able to disable automatic generation of User and Authority entities so that those entities can be used in normal entity relationships.

INFO! Using JHipster version installed globally
INFO! Executing import-jdl test.jdl
INFO! The JDL is being parsed.
warn: In the One-to-Many relationship from Company to User, only bidirectionality is supported for a One-to-Many association. The other side will be automatically added.
Error: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
Error while parsing applications and entities from the JDL Error: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
Error: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
    at checkForForbiddenUseOfUserAsSource (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:89:11)
    at checkForInvalidUseOfTheUserEntity (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:83:3)
    at RelationshipValidator.validate (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:37:5)
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/business_error_checker.js:158:17
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_object.js:202:7
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_relationships.js:90:7
    at Array.forEach (<anonymous>)
    at JDLRelationships.forEach (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_relationships.js:89:20)
    at JDLObject.forEachRelationship (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_object.js:201:24)
    at BusinessErrorChecker.checkForRelationshipErrors (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/business_error_checker.js:157:20)
Error during import-jdl: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
Error: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
    at checkForForbiddenUseOfUserAsSource (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:89:11)
    at checkForInvalidUseOfTheUserEntity (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:83:3)
    at RelationshipValidator.validate (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:37:5)
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/business_error_checker.js:158:17
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_object.js:202:7
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_relationships.js:90:7
    at Array.forEach (<anonymous>)
    at JDLRelationships.forEach (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_relationships.js:89:20)
    at JDLObject.forEachRelationship (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_object.js:201:24)
    at BusinessErrorChecker.checkForRelationshipErrors (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/business_error_checker.js:157:20)
Error: Error during import-jdl: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
    at module.exports (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/cli/import-jdl.js:428:31)
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/cli/jdl.js:93:51
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

I attempted to turn on debug logging level

DEBUG=generator-jhipster:* LOG_LEVEL=debug node --inspect /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/cli/cli.js import-jdl test.jdl --skip-user-management --ignore-application

The command runs, but it does not change logging level... if someone could tell me the correct syntax, I would be happy to investigate it further to see if I can determine where the breakdown occurs.

Motivation for or Use Case

For the project I'm working on, I use OIDC/OAuth2 to handle user authentication and identity management, we still need a User representation within our database for data-ownership.

We need to be able to update entities and regenerate classes as the project evolves, currently this bug blocks us from being able to do that.

Reproduce the error

jhipster jdl test.jdl --skip-user-management
test.jdl is attached in JHipster configuration section

Related issues

Issue was first opened against JHipster core jhipster/jhipster-core#476, but it seems more suitable to be here as it may not be a problem with JHipster only rather how the classes are generated.

Suggest a Fix

Skip User Management doesn't work through import jdl at all... Configuration is not being respected by lower level classes in generator-jhipster.

JHipster Version(s)


6.10.1

JHipster configuration
// skip-user-management

// application {
//     config {
//         packageName com.test.project.entities
//     }
//     entities *
// }

DEFAULT_MIN_LENGTH = 2
DEFAULT_MAX_LENGTH = 50

entity Company {
    name String required unique minlength(DEFAULT_MIN_LENGTH)
    abbreviation String required unique 
    config String required
    entities String required
    logo String
}

entity User { 
    name String required
    email String required pattern(/^[^@\s]+@[^@\s]+\.[^@\s]+$/) 
}

relationship OneToMany {
    Company to User{company(name)}
}

relationship ManyToOne {
    User to Company {user(name)}
}
Entity configuration(s) entityName.json files generated in the .jhipster directory

N/A

Browsers and Operating System

OSX 10.15

  • [x] Checking this box is mandatory (this is just to show you read everything)
area JDL

All 18 comments

// skip-user-management

This simply doesn't exist. There's the skipUserManagement application option.

closing this as there is no issue, following Mathieu's comment

// skip-user-management

I see, so you're saying it's a JHipster IDE only option, but it's not actually used by import-jdl

This simply doesn't exist. There's the skipUserManagement application option.

import-jdl doesn't have a way to skipUserManagement by design then... well that sucks.

Since it's not implemented, then the error message is wrong. It should state that skipUserManagement is not available from import-jdl.

@deftdawg I see some alternatives your problem:

  • You have removed application section on your jdl:
    jdl entity foo does not supports --skip-user-management. So it only work if you have a previous application with it enabled.
  • jhipster import-jdl file.jdl --skip-user-management should work if you have application section.
  • jdl does support 'skipUserManagement'
application { config { skipUserManagement } }

@mshima I tried app configuration flags before. Based on what you said this should work right? (I ran it both with and without --skip-user-management)

~/D/tmp> cat test.jdl
// skip-user-management

application {
    config {
        skipUserManagement true
    }
}

DEFAULT_MIN_LENGTH = 2
DEFAULT_MAX_LENGTH = 50

entity Company {
    name String required unique minlength(DEFAULT_MIN_LENGTH)
    abbreviation String required unique 
    config String required
    entities String required
    logo String
}

entity User { 
    name String required
    email String required pattern(/^[^@\s]+@[^@\s]+\.[^@\s]+$/) 
}

relationship OneToMany {
    Company to User{company(name)}
}

relationship ManyToOne {
    User to Company {user(name)}
}

~/D/tmp> jhipster jdl test.jdl
INFO! Using JHipster version installed globally
INFO! Executing import-jdl test.jdl
INFO! The JDL is being parsed.
warn: In the One-to-Many relationship from Company to User, only bidirectionality is supported for a One-to-Many association. The other side will be automatically added.
Error: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
Error while parsing applications and entities from the JDL Error: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
Error: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
    at checkForForbiddenUseOfUserAsSource (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:89:11)
    at checkForInvalidUseOfTheUserEntity (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:83:3)
    at RelationshipValidator.validate (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:37:5)
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/business_error_checker.js:158:17
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_object.js:202:7
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_relationships.js:90:7
    at Array.forEach (<anonymous>)
    at JDLRelationships.forEach (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_relationships.js:89:20)
    at JDLObject.forEachRelationship (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_object.js:201:24)
    at BusinessErrorChecker.checkForRelationshipErrors (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/business_error_checker.js:157:20)
Error during import-jdl: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
Error: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
    at checkForForbiddenUseOfUserAsSource (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:89:11)
    at checkForInvalidUseOfTheUserEntity (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:83:3)
    at RelationshipValidator.validate (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:37:5)
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/business_error_checker.js:158:17
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_object.js:202:7
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_relationships.js:90:7
    at Array.forEach (<anonymous>)
    at JDLRelationships.forEach (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_relationships.js:89:20)
    at JDLObject.forEachRelationship (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_object.js:201:24)
    at BusinessErrorChecker.checkForRelationshipErrors (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/business_error_checker.js:157:20)
Error: Error during import-jdl: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
    at module.exports (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/cli/import-jdl.js:428:31)
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/cli/jdl.js:93:51
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

~/D/tmp [1]> jhipster jdl test.jdl --skip-user-management
INFO! Using JHipster version installed globally
INFO! Executing import-jdl test.jdl
INFO! The JDL is being parsed.
warn: In the One-to-Many relationship from Company to User, only bidirectionality is supported for a One-to-Many association. The other side will be automatically added.
Error: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
Error while parsing applications and entities from the JDL Error: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
Error: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
    at checkForForbiddenUseOfUserAsSource (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:89:11)
    at checkForInvalidUseOfTheUserEntity (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:83:3)
    at RelationshipValidator.validate (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:37:5)
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/business_error_checker.js:158:17
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_object.js:202:7
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_relationships.js:90:7
    at Array.forEach (<anonymous>)
    at JDLRelationships.forEach (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_relationships.js:89:20)
    at JDLObject.forEachRelationship (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_object.js:201:24)
    at BusinessErrorChecker.checkForRelationshipErrors (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/business_error_checker.js:157:20)
Error during import-jdl: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
Error: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
    at checkForForbiddenUseOfUserAsSource (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:89:11)
    at checkForInvalidUseOfTheUserEntity (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:83:3)
    at RelationshipValidator.validate (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/relationship_validator.js:37:5)
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/business_error_checker.js:158:17
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_object.js:202:7
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_relationships.js:90:7
    at Array.forEach (<anonymous>)
    at JDLRelationships.forEach (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_relationships.js:89:20)
    at JDLObject.forEachRelationship (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_object.js:201:24)
    at BusinessErrorChecker.checkForRelationshipErrors (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/node_modules/jhipster-core/lib/validators/business_error_checker.js:157:20)
Error: Error during import-jdl: Relationships from the User entity is not supported in the declaration between 'User' and 'Company'. You can have this by using the 'skipUserManagement' option.
    at module.exports (/usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/cli/import-jdl.js:428:31)
    at /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/cli/jdl.js:93:51
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

I am reopening since in my opinion there are some bugs here.

  • It's possible to create entity called User and relationships like the example using prompts, tried and generated, didn't tried to execute.
  • I've managed to bypass the error with some changes.
  • Company entity is generating, with user relationship correctly:
"relationships": [
    {
      "relationshipType": "one-to-many",
      "otherEntityName": "user",
      "otherEntityRelationshipName": "company",
      "relationshipName": "user"
    },
    {
      "relationshipType": "one-to-many",
      "otherEntityName": "user",
      "otherEntityRelationshipName": "company",
      "relationshipName": "user"
    }
  ],

At current state custom User entity is completely broken using jdl.
At least we should throw an error if entity User is found in the jdl.

It’s related to https://github.com/jhipster/jhipster-core/pull/278 and https://github.com/jhipster/generator-jhipster/issues/10425

I have identified 3 cases that I think they are bugs:

  • User entity is ignored by jdl when skipUserManagement:
application {
    config {
        skipUserManagement true
    }
    entities *
}

entity User {
    name String required
}

and

application {
    config {
        skipUserManagement true
    }
    entities *
}

entity Company {
    name String required unique
}

entity User {
    name String required
}

relationship OneToMany {
    Company to User{company(name)}
}

This second example Company is generated with user relationship but User is missing.

  • jdl should throw when trying to override built-in User entity.
application {
    entities User
}

entity User {
    name String required
}
  • jdl should allow ManyToOne from user to another entity if skipUserManagement.
application {
    config {
        skipUserManagement true
    }
    entities *
}

entity Company {
    name String required unique
}

entity User {
    name String required
}

relationship ManyToOne {
    User to Company {user(name)}
}

@mshima I tried app configuration flags before. Based on what you said this should work right? (I ran it both with and without --skip-user-management)

@deftdawg I think a possible workaround is:

  • remove ManyToOne relationship, OneToMany would add a back reference anyway.
  • after importing, create User using prompt jhipster entity User.
application {
    config {
        skipUserManagement true
    }
    entities *
}

DEFAULT_MIN_LENGTH = 2
DEFAULT_MAX_LENGTH = 50

entity Company {
    name String required unique minlength(DEFAULT_MIN_LENGTH)
    abbreviation String required unique 
    config String required
    entities String required
    logo String
}

entity User { 
    name String required
    email String required pattern(/^[^@\s]+@[^@\s]+\.[^@\s]+$/) 
}

relationship OneToMany {
    Company to User{company(name)}
}

Seems like a bad refactoring happened, my bad. It's an app option.
I'll fix it after I'm done with another issue

Thanks for the deep analysis @mshima!

Thanks for looking into this @MathieuAA
Thanks for the suggestion @mshima. I gave it a shot and here's what I found:

  • removing the ManyToOne back link did allow the JDL to parse and JHipster ran generating an application
  • No Company entity was generated (no .jhipster directory)
  • The .yo-rc.json has correct settings for skipUserManagement recorded, however no entities:
{
  "generator-jhipster": {
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "clientFramework": "angularX",
    "serverPort": "8080",
    "serviceDiscoveryType": false,
    "skipUserManagement": true,
    "baseName": "jhipster",
//...
  },
  "entities": []
}

Running jhipster entity User runs, but bombs out when attempting to create relationships to Company.

jhipster entity User
INFO! Using JHipster version installed locally in current project's node_modules
INFO! Executing jhipster:entity User

The entity User is being created.


Generating field #1

? Do you want to add a field to your entity? Yes
? What is the name of your field? name
? What is the type of your field? String
? Do you want to add validation rules to your field? Yes
? Which validation rules do you want to add? 

================= User =================
Fields
name (String) 


Generating field #2

? Do you want to add a field to your entity? Yes
? What is the name of your field? email
? What is the type of your field? String
? Do you want to add validation rules to your field? Yes
? Which validation rules do you want to add? 

================= User =================
Fields
name (String) 
email (String) 


Generating field #3

? Do you want to add a field to your entity? No

================= User =================
Fields
name (String) 
email (String) 


Generating relationships to other entities

? Do you want to add a relationship to another entity? Yes
? What is the name of the other entity? Company
? What is the name of the relationship? company
? What is the type of the relationship? many-to-one
? When you display this relationship on client-side, which field from 'Company' do you want to use? This field will be displayed as a String, so it cannot be a Blob name
? Do you want to add any validation rules to this relationship? Yes
? Which validation rules do you want to add? 

================= User =================
Fields
name (String) 
email (String) 

Relationships
company (Company) many-to-one 


Generating relationships to other entities

? Do you want to add a relationship to another entity? No

================= User =================
Fields
name (String) 
email (String) 

Relationships
company (Company) many-to-one 



? Do you want to use separate service class for your business logic? No, the REST controller should use the repository directly
? Is this entity read-only? No
? Do you want pagination on your entity? No

Everything is configured, generating the entity...

WARNING! otherEntityRelationshipName is missing in .jhipster/User.json for relationship {
    "relationshipName": "company",
    "otherEntityName": "company",
    "relationshipType": "many-to-one",
    "relationshipValidateRules": [],
    "otherEntityField": "name",
    "otherEntityRelationshipName": "user"
}, using user as fallback
WARNING! changelogDate is missing in .jhipster/User.json, using 20200910212905 as fallback
   create src/main/resources/config/liquibase/changelog/20200910212905_added_entity_User.xml
   create src/main/resources/config/liquibase/changelog/20200910212905_added_entity_constraints_User.xml
   create src/main/resources/config/liquibase/fake-data/user.csv
   create src/main/java/com/mycompany/myapp/domain/User.java
   create src/main/java/com/mycompany/myapp/web/rest/UserResource.java
   create src/main/java/com/mycompany/myapp/repository/UserRepository.java
   create src/test/java/com/mycompany/myapp/web/rest/UserResourceIT.java
   create src/test/java/com/mycompany/myapp/domain/UserTest.java
 conflict src/main/resources/config/liquibase/master.xml
? Overwrite src/main/resources/config/liquibase/master.xml? overwrite
    force src/main/resources/config/liquibase/master.xml
 conflict src/main/java/com/mycompany/myapp/config/CacheConfiguration.java
? Overwrite src/main/java/com/mycompany/myapp/config/CacheConfiguration.java? overwrite
    force src/main/java/com/mycompany/myapp/config/CacheConfiguration.java
   create src/main/webapp/app/entities/user/user.component.html
   create src/main/webapp/app/entities/user/user-detail.component.html
   create src/main/webapp/app/entities/user/user-update.component.html
   create src/main/webapp/app/entities/user/user-delete-dialog.component.html
 conflict src/main/webapp/app/layouts/navbar/navbar.component.html
? Overwrite src/main/webapp/app/layouts/navbar/navbar.component.html? overwrite this and all others
    force src/main/webapp/app/layouts/navbar/navbar.component.html
    force .yo-rc.json
   create .jhipster/User.json
   create src/main/webapp/app/shared/model/user.model.ts
   create src/main/webapp/app/entities/user/user.module.ts
   create src/main/webapp/app/entities/user/user.route.ts
   create src/main/webapp/app/entities/user/user.component.ts
   create src/main/webapp/app/entities/user/user-detail.component.ts
   create src/main/webapp/app/entities/user/user.service.ts
   create src/main/webapp/app/entities/user/user-update.component.ts
   create src/main/webapp/app/entities/user/user-delete-dialog.component.ts
   create src/test/javascript/spec/app/entities/user/user-detail.component.spec.ts
   create src/test/javascript/spec/app/entities/user/user.component.spec.ts
   create src/test/javascript/spec/app/entities/user/user.service.spec.ts
   create src/test/javascript/spec/app/entities/user/user-update.component.spec.ts
   create src/test/javascript/spec/app/entities/user/user-delete-dialog.component.spec.ts
    force src/main/webapp/app/entities/entity.module.ts
   create src/main/webapp/i18n/en/user.json
    force src/main/webapp/i18n/en/global.json
   create src/main/webapp/i18n/fr/user.json
    force src/main/webapp/i18n/fr/global.json

Running `webpack:build` to update client app

Entity User generated successfully.

> [email protected] webpack:build /Users/ged/Downloads/tmp
> npm run cleanup && npm run webpack:build:main


> [email protected] cleanup /Users/ged/Downloads/tmp
> rimraf target/classes/static/


> [email protected] webpack:build:main /Users/ged/Downloads/tmp
> npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal


> [email protected] webpack /Users/ged/Downloads/tmp
> node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.dev.js" "--env.stats=minimal"

Webpack: Starting ...
Compiling @angular/core : es2015 as esm2015
Compiling @angular/compiler/testing : es2015 as esm2015
Compiling @ngx-translate/core : es2015 as esm2015
Compiling @angular/common : es2015 as esm2015
Compiling @angular/core/testing : es2015 as esm2015
Compiling ngx-infinite-scroll : es2015 as esm2015
Compiling @angular/platform-browser : es2015 as esm2015
Compiling @angular/common/http : es2015 as esm2015
Compiling @angular/common/testing : es2015 as esm2015
Compiling @angular/router : es2015 as esm2015
Compiling @angular/forms : es2015 as esm2015
Compiling @fortawesome/angular-fontawesome : es2015 as esm2015
Compiling @angular/platform-browser-dynamic : es2015 as esm2015
Compiling @angular/platform-browser/testing : es2015 as esm2015
Compiling ngx-cookie-service : es2015 as esm2015
Compiling @fortawesome/angular-fontawesome/testing : es2015 as esm2015
Compiling @ngx-translate/http-loader : es2015 as esm2015
Compiling @angular/common/http/testing : es2015 as esm2015
Compiling ngx-webstorage : es2015 as esm2015
Compiling @angular/platform-browser-dynamic/testing : es2015 as esm2015
Compiling @ng-bootstrap/ng-bootstrap : es2015 as esm2015
Compiling @angular/router/testing : es2015 as esm2015
Webpack: Starting ...

  ✔ Compile modules
  ✔ Build modules
  ✔ Optimize modules
  ✔ Emit files

Webpack: Finished after 9.592 seconds.



 ERROR  Failed to compile with 1 errors                                                                                                                                                                                                                                             5:29:57 PM

 error  

src/main/webapp/app/shared/model/user.model.ts:1:26 - error TS2307: Cannot find module 'app/shared/model/company.model' or its corresponding type declarations.

1 import { ICompany } from 'app/shared/model/company.model';
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main/webapp/app/entities/user/user-update.component.ts:10:26 - error TS2307: Cannot find module 'app/shared/model/company.model' or its corresponding type declarations.

10 import { ICompany } from 'app/shared/model/company.model';
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main/webapp/app/entities/user/user-update.component.ts:11:32 - error TS2307: Cannot find module 'app/entities/company/company.service' or its corresponding type declarations.

11 import { CompanyService } from 'app/entities/company/company.service';
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


   5 modules

ERROR in src/main/webapp/app/shared/model/user.model.ts:1:26 - error TS2307: Cannot find module 'app/shared/model/company.model' or its corresponding type declarations.

1 import { ICompany } from 'app/shared/model/company.model';
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main/webapp/app/entities/user/user-update.component.ts:10:26 - error TS2307: Cannot find module 'app/shared/model/company.model' or its corresponding type declarations.

10 import { ICompany } from 'app/shared/model/company.model';
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main/webapp/app/entities/user/user-update.component.ts:11:32 - error TS2307: Cannot find module 'app/entities/company/company.service' or its corresponding type declarations.

11 import { CompanyService } from 'app/entities/company/company.service';
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] webpack: `node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.dev.js" "--env.stats=minimal"`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ged/.npm/_logs/2020-09-10T21_29_57_839Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] webpack:build:main: `npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] webpack:build:main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ged/.npm/_logs/2020-09-10T21_29_57_856Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] webpack:build: `npm run cleanup && npm run webpack:build:main`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] webpack:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ged/.npm/_logs/2020-09-10T21_29_57_872Z-debug.log
INFO! Congratulations, JHipster execution is complete!

Thanks for looking into this @MathieuAA
Thanks for the suggestion @mshima. I gave it a shot and here's what I found:

  • removing the ManyToOne back link did allow the JDL to parse and JHipster ran generating an application
  • No Company entity was generated (no .jhipster directory)

Have you added entities *?

@mshima dough, nope forgot that... rerunning now and Company has been detected. My bad.

  "entities": ["Company", "User"]

Looks like it worked! 🍻

./src/main/java/com/mycompany/myapp/domain/User.java
./src/main/java/com/mycompany/myapp/domain/Company.java
./src/main/webapp/app/shared/model/user.model.ts
./src/main/webapp/app/shared/model/company.model.ts

Any updates @mshima?

@mraible I created a PR to ignore jdl validation https://github.com/jhipster/generator-jhipster/pull/12439.
But it’s a workaround.
@MathieuAA was working to fix the jdl part.

I expect to do a PR this WE. It's working, just needs some tests.

Done.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcelinobadin picture marcelinobadin  ·  3Comments

RizziCR picture RizziCR  ·  3Comments

ahmedeldeeb25 picture ahmedeldeeb25  ·  3Comments

lsadehaan picture lsadehaan  ·  3Comments

dronavallisaikrishna picture dronavallisaikrishna  ·  3Comments