jhipster / jhipster-core

JHipster Domain Language, used by JHipster UML and JDL-Studio to generate entities
Apache License 2.0
345 stars 114 forks source link

Application options throw errors: skipUserManagement and devDatabaseType h2Disk #211

Closed bertyg closed 6 years ago

bertyg commented 6 years ago

The issue

Two application options throw errors:

Error: ERROR! Error while parsing applications and entities from the JDL TypeError: Cannot read property 'start' of undefined at Environment.error (/home/berty/.config/yarn/global/node_modules/yeoman-environment/lib/environment.js:157:40) at module.exports.error (/home/berty/.config/yarn/global/node_modules/generator-jhipster/generators/generator-base.js:1970:18) at module.exports.parseJDL (/home/berty/.config/yarn/global/node_modules/generator-jhipster/generators/import-jdl/index.js:155:26) at Object. (/home/berty/.config/yarn/global/node_modules/yeoman-generator/lib/index.js:399:25) at /home/berty/.config/yarn/global/node_modules/run-async/index.js:25:25 at new Promise () at /home/berty/.config/yarn/global/node_modules/run-async/index.js:24:19 at self.env.runLoop.add.completed (/home/berty/.config/yarn/global/node_modules/yeoman-generator/lib/index.js:400:11) at runCallback (timers.js:794:20) at tryOnImmediate (timers.js:752:5) at processImmediate [as _immediateCallback] (timers.js:729:5)

* devDatabaseType h2Disk

error: An error has occurred: SyntaxError error: Error message: Expected ",", "/", "applicationType", "authenticationType", "baseName", "buildTool", "cacheProvider", "clientFramework", "clientPackageManager", "databaseType", "devDatabaseType", "enableHibernateCache", "enableSwaggerCodegen", "enableTranslation", "jhiPrefix", "jhipsterVersion", "languages", "messageBroker", "nativeLanguage", "packageName", "path", "prodDatabaseType", "searchEngine", "serverPort", "serviceDiscoveryType", "skipClient", "skipServer", "skipUserManagement", "testFrameworks", "uaaBaseName", "useSass", "websocket", "}", [A-Za-z], or [\n\t\r 

] but "2" found. error: Position: At l.17. DEBUG! Error: SyntaxError: SyntaxError: Expected ",", "/", "applicationType", "authenticationType", "baseName", "buildTool", "cacheProvider", "clientFramework", "clientPackageManager", "databaseType", "devDatabaseType", "enableHibernateCache", "enableSwaggerCodegen", "enableTranslation", "jhiPrefix", "jhipsterVersion", "languages", "messageBroker", "nativeLanguage", "packageName", "path", "prodDatabaseType", "searchEngine", "serverPort", "serviceDiscoveryType", "skipClient", "skipServer", "skipUserManagement", "testFrameworks", "uaaBaseName", "useSass", "websocket", "}", [A-Za-z], or [\n\t\r 

] but "2" found. at parse (/home/berty/.config/yarn/global/node_modules/jhipster-core/lib/reader/jdl_reader.js:48:11) at Object.parseFromFiles (/home/berty/.config/yarn/global/node_modules/jhipster-core/lib/reader/jdl_reader.js:73:10) at module.exports.parseJDL (/home/berty/.config/yarn/global/node_modules/generator-jhipster/generators/import-jdl/index.js:104:44) at Object. (/home/berty/.config/yarn/global/node_modules/yeoman-generator/lib/index.js:399:25) at /home/berty/.config/yarn/global/node_modules/run-async/index.js:25:25 at new Promise () at /home/berty/.config/yarn/global/node_modules/run-async/index.js:24:19 at self.env.runLoop.add.completed (/home/berty/.config/yarn/global/node_modules/yeoman-generator/lib/index.js:400:11) at runCallback (timers.js:794:20) at tryOnImmediate (timers.js:752:5) at processImmediate [as _immediateCallback] (timers.js:729:5) SyntaxError: SyntaxError: Expected ",", "/*", "applicationType", "authenticationType", "baseName", "buildTool", "cacheProvider", "clientFramework", "clientPackageManager", "databaseType", "devDatabaseType", "enableHibernateCache", "enableSwaggerCodegen", "enableTranslation", "jhiPrefix", "jhipsterVersion", "languages", "messageBroker", "nativeLanguage", "packageName", "path", "prodDatabaseType", "searchEngine", "serverPort", "serviceDiscoveryType", "skipClient", "skipServer", "skipUserManagement", "testFrameworks", "uaaBaseName", "useSass", "websocket", "}", [A-Za-z], or [\n\t\r 

] but "2" found.


---

### Motivation for or Use Case

<!-- Explain why this is a bug or a new feature for you -->

These options should not throw errors

---

### Reproduce the error

<!-- For bug reports, an unambiguous set of steps to reproduce the error -->
add these two options in a JDL and run import-jdl

---

### Related issues

<!-- Has a similar issue been reported before? Please search both closed & open issues -->

---

### Suggest a Fix

<!-- For bug reports, if you can't fix the bug yourself, perhaps you can point to what might be
  causing the problem (line of code or commit) -->

---

### The JDL file

// Applications

application { config { applicationType microservice, authenticationType uaa, baseName marketplace, buildTool maven, cacheProvider hazelcast, databaseType sql, devDatabaseType h2Disk, enableHibernateCache true, enableSwaggerCodegen false, enableTranslation true, jhiPrefix jhi, languages [en, fr], messageBroker false, nativeLanguage en, packageName com.tce.services.marketplace, prodDatabaseType mysql, searchEngine elasticsearch, serverPort 8081, serviceDiscoveryType eureka, skipClient true, skipServer false, skipUserManagement true, testFrameworks [cucumber], uaaBaseName "../uaa", useSass false, websocket false } }

application { config { applicationType uaa, authenticationType uaa, baseName uaa, buildTool maven, cacheProvider hazelcast, databaseType sql, devDatabaseType h2Disk, enableHibernateCache true, enableSwaggerCodegen false, enableTranslation true, jhiPrefix jhi, languages [en, fr], messageBroker false, nativeLanguage en, packageName com.tce.uaa, prodDatabaseType mysql, searchEngine false, serverPort 9999, serviceDiscoveryType eureka, skipClient true, skipServer false, testFrameworks [cucumber], uaaBaseName "../uaa", useSass false, websocket false } }



---

### Versions 
<!-- You have to specify the version. -->
| JHipster           |
| ------------------ |
| `5.0.0-beta.1` |

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

<!-- Love JHipster? Please consider supporting our collective:
👉  https://opencollective.com/generator-jhipster/donate -->
PierreBesson commented 6 years ago

It's absolutely not supported to generate an UAA without user management. The main reason to use an UAA is to combine JHipster user management with Spring @enableauthserver. If you remove user management from the UAA then nothing will work properly.

Eventually we could introduce a check that prevents you from choosing both options and displays an error message...

bertyg commented 6 years ago

Hi Pierre, Thanks for the response. Sorry, I tried to be concise by uniting all options under the uaa but didn't double check if that had an impact in the application context. I edited the sample JDL file , to show all applications, with appropriate options.

MathieuAA commented 6 years ago

Hi, thanks for the report.Pierre's solution is the way to go.I'll try to do it today.