当我导入JDL时,C:\ temp \ vdemo5> jhipster import-jdl room10.jh
导入失败,我无法弄清原因。能否请你帮忙?
其他导入也会发生此错误。

这是我的JDL文件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


===================================
这是命令和错误:

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>)


=====================================
这是我的.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"
    ]
  }
}

最佳答案

您的jdl中可能是类型错误。尝试在您的Integer实体中使用Int代替Room

09-16 04:46