3

WHEN I import JDL, C:\temp\vdemo5>jhipster import-jdl room10.jh The import failed, I am not able to figure out why. Could you please help? This error happens for other imports also.

Here is my JDL file room10.hj:

entity Room {
    name String,
    occupancyLimit Int,
    available Boolean
}

entity Reservation {
    userId Long required,
    title String
}

entity Building {
    name String
}

entity Roomnotavaible {
    startTime Instant,
    endTime Instant
}

relationship ManyToOne {
    Room{building(name)} to Building,
    Reservation{room(name)} to Room,
    Roomnotavaible{room(name)} to Room
}

paginate Room with infinite-scroll

==================================== Here is the command and errors:

C:\temp\vdemo5>jhipster import-jdl room10.jh
Using JHipster version installed locally in current project's node_modules
Executing jhipster:import-jdl room10.jh
Options:
The JDL is being parsed.
Found entities: Room, Roomnotavaible.
The JDL has been successfully parsed
Generating 2 entities.
Generating 2 entities.

Found the .jhipster/Room.json configuration file, entity can be automatically generated!


The entity Room is being updated.


Found the .jhipster/Roomnotavaible.json configuration file, entity can be automatically generated!


The entity Roomnotavaible is being updated.

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: ERROR! Copying template src/test/java/package/web/rest/EntityResourceIntTest.java.ejs failed. [TypeError: C:\temp\vdemo5\node_modules\generator-jhipster\generators\entity-server\templates\src\test\java\package\web\rest\EntityResourceIntTest.java.ejs:230
    228|     private static final String <%=defaultValueName %> = "<%-sampleTextString %>";
    229|     private static final String <%=updatedValueName %> = "<%-updatedTextString %>";
 >> 230| <%_ } else if (fieldType === 'Integer') { _%>
    231|
    232|     private static final Integer <%=defaultValueName %> = <%= defaultValue %>;
    233|     private static final Integer <%=updatedValueName %> = <%= updatedValue %>;

Cannot read property 'replace' of undefined]
    at Environment.error (C:\temp\vdemo5\node_modules\generator-jhipster\node_modules\yeoman-environment\lib\environment.js:157:40)
    at module.exports.error (C:\temp\vdemo5\node_modules\generator-jhipster\generators\generator-base.js:1978:18)
    at ejs.renderFile (C:\temp\vdemo5\node_modules\generator-jhipster\generators\utils.js:197:23)
    at tryHandleCache (C:\temp\vdemo5\node_modules\ejs\lib\ejs.js:254:14)
    at Object.exports.renderFile (C:\temp\vdemo5\node_modules\ejs\lib\ejs.js:482:10)
    at Object.renderContent (C:\temp\vdemo5\node_modules\generator-jhipster\generators\utils.js:193:9)
    at module.exports.template (C:\temp\vdemo5\node_modules\generator-jhipster\generators\generator-base-private.js:636:23)
    at blockTemplate.templates.forEach (C:\temp\vdemo5\node_modules\generator-jhipster\generators\generator-base.js:2326:42)
    at Array.forEach (<anonymous>)

====================================== Here is my .yo-rc.json

{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.variq.api",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "5.0.2",
    "applicationType": "gateway",
    "baseName": "vdemo5",
    "packageName": "com.variq.api",
    "packageFolder": "com/variq/api",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Memory",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "a7f7bef8817ec82c2ca0ed3ecafc980346c42c81",
    "clientFramework": "angularX",
    "useSass": false,
    "clientPackageManager": "yarn",
    "testFrameworks": [
      "protractor"
    ],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "es"
    ]
  }
}
Mohsen
  • 4,536
  • 2
  • 27
  • 49
Max
  • 31
  • 2

1 Answers1

4

It might be a type error in your jdl. Try using Integer instead of Int in your Room entity.

Alexandre GC
  • 553
  • 3
  • 8
  • Thanks so much, Alex, will do – Max Jul 25 '18 at 15:31
  • 1
    That solved my problem! Thanks Alex. If someone runs into the similar issue, this can help. in JDL, not use "Int", use "Integer". once the code is generated, it is hard to get rid of the issue, I have to build the app from scratch, if that is not possible, we have to pull he last version of code from source code. – Max Jul 25 '18 at 19:49