Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regenerate failed by jdl if without git init for root folder #27906

Open
1 task done
flyliu33 opened this issue Nov 18, 2024 · 0 comments
Open
1 task done

regenerate failed by jdl if without git init for root folder #27906

flyliu33 opened this issue Nov 18, 2024 · 0 comments

Comments

@flyliu33
Copy link

flyliu33 commented Nov 18, 2024

Overview of the issue

modified-microservice-ecommerce-store-4-apps.txt
original-microservice-ecommerce-store-4-apps.txt

I generated my microservice project by execute jhipster jdl .\original-microservice-ecommerce-store-4-apps.jdl --auto-crlf, then it would arise the following errors.

ERROR! An error occured while running jhipster:bootstrap#commitPrettierConfig
ERROR! ERROR! D:\workspace\ms-ecommerce-store is not inside a git repository
Error: D:\workspace\ms-ecommerce-store is not inside a git repository
    at autoCrlfTransform (file:///C:/Users/flyli/AppData/Roaming/nvm/v20.17.0/node_modules/generator-jhipster/dist/generators/bootstrap/support/auto-crlf-transform.js:56:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async BootstrapGenerator.commitSharedFs (file:///C:/Users/flyli/AppData/Roaming/nvm/v20.17.0/node_modules/generator-jhipster/dist/generators/bootstrap/generator.js:173:37)
    at async BootstrapGenerator.commitPrettierConfig (file:///C:/Users/flyli/AppData/Roaming/nvm/v20.17.0/node_modules/generator-jhipster/dist/generators/bootstrap/generator.js:137:9)
    at async BootstrapGenerator.method (file:///C:/Users/flyli/AppData/Roaming/nvm/v20.17.0/node_modules/generator-jhipster/dist/generators/bootstrap/generator.js:128:17)
    at async BootstrapGenerator.executeTask (file:///C:/Users/flyli/AppData/Roaming/nvm/v20.17.0/node_modules/generator-jhipster/node_modules/yeoman-generator/dist/actions/lifecycle.js:258:13)
    at async runLoop.add.once (file:///C:/Users/flyli/AppData/Roaming/nvm/v20.17.0/node_modules/generator-jhipster/node_modules/yeoman-environment/dist/environment-base.js:395:17)

I modified the jdl file as usually, and executed jhipster jdl .\modified-microservice-ecommerce-store-4-apps.jdl --auto-crlf, then I found my new entity couldn't be generated.

Motivation for or Use Case

modifying the regular entities.

Reproduce the error
  1. create a new folder and copy the two attachments into this new folder.
  2. execute jhipster jdl .\original-microservice-ecommerce-store-4-apps.jdl --auto-crlf
  3. execute jhipster jdl .\modified-microservice-ecommerce-store-4-apps.jdl --auto-crlf
Related issues
Suggest a Fix

After I execute git init for the root folder, error disappeared and everything works.

JHipster Version(s)

v8.7.3

JHipster configuration
    ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
    ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
    ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝

██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║
╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗
╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝
https://www.jhipster.tech
Welcome to JHipster v8.7.3

Welcome to the JHipster Information Sub-Generator

[email protected] D:\workspace\test\jhipster\ms-ecommerce-store\store
`-- [email protected]
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationIndex": 0,
    "applicationType": "gateway",
    "applications": {
      "invoice": {
        "applicationIndex": 2,
        "serverPort": "8082"
      },
      "notification": {
        "applicationIndex": 3,
        "serverPort": "8083"
      },
      "product": {
        "applicationIndex": 1,
        "serverPort": "8081"
      }
    },
    "authenticationType": "jwt",
    "autoCrlf": true,
    "baseName": "store",
    "buildTool": "maven",
    "cacheProvider": "no",
    "clientFramework": "vue",
    "clientTheme": "none",
    "creationTimestamp": 1731899799300,
    "databaseType": "sql",
    "devDatabaseType": "mysql",
    "devServerPort": 9060,
    "enableHibernateCache": false,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "entities": [
      "Customer",
      "Employee",
      "Company",
      "Product",
      "ProductType",
      "ProductCategory",
      "ProductOrder",
      "ProductOrderTest",
      "OrderItem",
      "Invoice",
      "Shipment",
      "Notification"
    ],
    "jhiPrefix": "sys",
    "jhipsterVersion": "8.7.3",
    "languages": [
      "zh-cn"
    ],
    "lastLiquibaseTimestamp": 1731658656000,
    "messageBroker": false,
    "nativeLanguage": "zh-cn",
    "packageName": "com.jhipster.demo.store",
    "prodDatabaseType": "mysql",
    "reactive": true,
    "searchEngine": false,
    "serverPort": "8080",
    "serviceDiscoveryType": "consul",
    "testFrameworks": [
      "gatling",
      "cypress"
    ],
    "websocket": false
  }
}
Environment and Tools

openjdk version "17.0.12" 2024-07-16 LTS
OpenJDK Runtime Environment Corretto-17.0.12.7.1 (build 17.0.12+7-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.12.7.1 (build 17.0.12+7-LTS, mixed mode, sharing)

git version 2.45.1.windows.1

node: v20.18.0
npm: 10.8.2

Docker version 27.1.1, build 6312585

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
/**
 * 订单
 */
entity ProductOrderTest {
  id UUID
  /**
   * 下单日期
   */
  placedDate Instant required
  /**
   * 订单状态
   */
  status OrderStatus required
  /**
   * 订单编号
   */
  code String required
  /**
   * 发票ID
   */
  invoiceId Long
  /**
   * 客户
   */
  customer String required
}
/**
 * 客户
 */
@ChangelogDate("20241115080736")
entity Customer {
  id Long
  /**
   * 名字
   */
  firstName String required
  /**
   * 姓氏
   */
  lastName String required
  /**
   * 性别
   */
  gender Gender required
  /**
   * 电子邮件
   */
  email String required pattern(/^[^@\s]+@[^@\s]+\.[^@\s]+$/)
  /**
   * 电话
   */
  phone String required
  /**
   * 地址1
   */
  addressLine1 String required
  /**
   * 地址2
   */
  addressLine2 String
  /**
   * 城市
   */
  city String required
  /**
   * 州
   */
  state String
  /**
   * 国家
   */
  country String required
}
/**
 * 员工
 */
@ChangelogDate("20241115080836")
entity Employee {
  id Long required
  /**
   * 名字
   */
  firstName String required
  /**
   * 姓氏
   */
  lastName String required
  /**
   * 手机号码
   */
  mobileNo String maxlength(11)
  /**
   * 性别
   */
  sex Gender
}
/**
 * 公司
 */
@ChangelogDate("20241115080936")
entity Company {
  id Long required
  /**
   * 名称
   */
  name String
  /**
   * 联系人
   */
  contact String
}
/**
 * Product sold by the Online store
 */
@ChangelogDate("20241115081036")
entity Product {
  id Long
  name String required
  description String
  price BigDecimal required min(0)
  productSize Size required
  comment String
  image ImageBlob
}
/**
 * 商品类型
 */
@ChangelogDate("20241115081136")
entity ProductType {
  id Long
  /**
   * 类型名称
   */
  name String required
  /**
   * 类型描述
   */
  description String
}
@ChangelogDate("20241115081236")
entity ProductCategory {
  id Long
  name String required
  description String
}
/**
 * 订单
 */
@ChangelogDate("20241115081336")
entity ProductOrder {
  id UUID
  /**
   * 下单日期
   */
  placedDate Instant required
  /**
   * 订单状态
   */
  status OrderStatus required
  /**
   * 订单编号
   */
  code String required
  /**
   * 发票ID
   */
  invoiceId Long
  /**
   * 客户
   */
  customer String required
}
@ChangelogDate("20241115081436")
entity OrderItem {
  id UUID
  quantity Integer required min(0)
  totalPrice BigDecimal required min(0)
  status OrderItemStatus required
}
/**
 * 发票
 */
@ChangelogDate("20241115081536")
entity Invoice {
  id Long
  /**
   * 发票号码
   */
  code String required
  /**
   * 发票日期
   */
  date Instant required
  /**
   * 发票详情
   */
  details String
  /**
   * 发票状态
   */
  status InvoiceStatus required
  /**
   * 付款方式
   */
  paymentMethod PaymentMethod required
  /**
   * 付款日期
   */
  paymentDate Instant required
  /**
   * 付款金额
   */
  paymentAmount BigDecimal required
}
@ChangelogDate("20241115081636")
entity Shipment {
  id Long
  trackingCode String
  date Instant required
  details String
}
/**
 * 通知
 */
@ChangelogDate("20241115081736")
entity Notification {
  id UUID
  /**
   * 通知日期
   */
  date Instant required
  /**
   * 通知详情
   */
  details String
  /**
   * 发送日期
   */
  sentDate Instant required
  /**
   * 通知类型
   */
  format NotificationType required
  /**
   * 通知用户ID
   */
  userId Long required
  /**
   * 产品ID
   */
  productId Long required
}

/**
 * 订单状态
 */
enum OrderStatus {
  COMPLETED,
  PENDING,
  CANCELLED
}
/**
 * 性别
 */
enum Gender {
  MALE,
  FEMALE,
  OTHER
}
enum Size {
  S,
  M,
  L,
  XL,
  XXL
}
enum OrderItemStatus {
  AVAILABLE,
  OUT_OF_STOCK,
  BACK_ORDER
}
enum InvoiceStatus {
  PAID,
  ISSUED,
  CANCELLED
}
enum PaymentMethod {
  CREDIT_CARD,
  CASH_ON_DELIVERY,
  PAYPAL
}
enum NotificationType {
  EMAIL,
  SMS,
  PARCEL
}

relationship OneToOne {
  Customer{user(login) required} to User with builtInEntity
}
relationship OneToMany {
  ProductCategory{product} to Product{productCategory(name)}
  ProductOrder{orderItem} to OrderItem{order(code) required}
  Invoice{shipment} to Shipment{invoice(code) required}
}
relationship ManyToOne {
  OrderItem{product(name) required} to Product
}
relationship ManyToMany {
  Company{employee(firstName)} to Employee{company(name)}
  Product{productType(name)} to ProductType{product(name)}
}

dto ProductOrderTest, Customer, Employee, Company, Product, ProductType, ProductCategory, ProductOrder, OrderItem, Invoice, Shipment, Notification with mapstruct
service ProductOrderTest, Customer, Employee, Company, Product, ProductType, ProductCategory, ProductOrder, OrderItem, Invoice, Shipment, Notification with serviceClass
microservice ProductOrderTest, Product, ProductCategory, ProductOrder, OrderItem with product
microservice Invoice, Shipment with invoice
microservice Notification with notification
paginate Customer, Employee, Company, Product, ProductOrder, OrderItem, Invoice, Shipment with pagination
search Customer, Employee, Company, Product, ProductType, ProductCategory, ProductOrder, OrderItem, Invoice, Shipment, Notification with no
clientRootFolder Product, ProductCategory, ProductOrder, OrderItem with product
clientRootFolder Invoice, Shipment with invoice
clientRootFolder Notification with notification

Congratulations, JHipster execution is complete!
If you find JHipster useful consider sponsoring the project https://www.jhipster.tech/sponsors/

Thanks for using JHipster!

Browsers and Operating System

Edition Windows 11 Pro
Version 23H2
Installed on ‎8/‎19/‎2024
OS build 22631.4391
Experience Windows Feature Experience Pack 1000.22700.1047.0

  • Checking this box is mandatory (this is just to show you read everything)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants