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

Generating code by jdl cannot adjust the original line separators, always convert code with LF instead of CRLF #27783

Closed
1 task done
flyliu33 opened this issue Nov 4, 2024 · 1 comment

Comments

@flyliu33
Copy link

flyliu33 commented Nov 4, 2024

Overview of the issue

I developed a project by jhipster with jdl on Windows 11 platform, after generating code by jdl, the line separator mode of the files of my project will tranform from CRLF to LF which conflict against git while comparing code by Jetbrains IDEAJ.

image

Motivation for or Use Case
Reproduce the error
  1. Generate app from JDL (files are generated with LF ending)
  2. Change the line separators of the whole project from LF to CRLF in IDEAJ. Select the root folder -> click File Menu -> select File Properties -> Select Line Separators -> Select CRLF.
  3. Now all of the files would be CRLF mode.
  4. Rerun app generation
  5. Compare files in Commit View. It will show difference of line separators.
Related issues

#19461

Suggest a Fix
JHipster Version(s)

8.7.3

JHipster configuration

microservice-ecommerce-store-4-apps.txt

.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",
    "baseName": "store",
    "buildTool": "maven",
    "cacheProvider": "no",
    "clientFramework": "vue",
    "devServerPort": 9060,
    "entities": [
      "Customer",
      "Product",
      "ProductCategory",
      "ProductOrder",
      "OrderItem",
      "Invoice",
      "Shipment",
      "Notification"
    ],
    "jhipsterVersion": "8.7.3",
    "languages": [
      "en"
    ],
    "lastLiquibaseTimestamp": 1730345890000,
    "nativeLanguage": "en",
    "packageName": "com.jhipster.demo.store",
    "prodDatabaseType": "mysql",
    "reactive": true,
    "serverPort": 8080,
    "serviceDiscoveryType": "consul",
    "testFrameworks": [
      "cypress"
    ]
  }
}
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.17.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
@ChangelogDate("20241031033110")
entity Customer {
  firstName String required
  lastName String required
  gender Gender required
  email String required pattern(/^[^@\s]+@[^@\s]+\.[^@\s]+$/)
  phone String required
  addressLine1 String required
  addressLine2 String
  city String required
  country String required
}
/**
 * Product sold by the Online store
 */
@ChangelogDate("20241031033210")
entity Product {
  name String required
  description String
  price BigDecimal required min(0)
  productSize Size required
  image ImageBlob
}
@ChangelogDate("20241031033310")
entity ProductCategory {
  name String required
  description String
}
@ChangelogDate("20241031033410")
entity ProductOrder {
  placedDate Instant required
  status OrderStatus required
  code String required
  invoiceId Long
  customer String required
}
@ChangelogDate("20241031033510")
entity OrderItem {
  quantity Integer required min(0)
  totalPrice BigDecimal required min(0)
  status OrderItemStatus required
}
@ChangelogDate("20241031033610")
entity Invoice {
  code String required
  date Instant required
  details String
  status InvoiceStatus required
  paymentMethod PaymentMethod required
  paymentDate Instant required
  paymentAmount BigDecimal required
}
@ChangelogDate("20241031033710")
entity Shipment {
  trackingCode String
  date Instant required
  details String
}
@ChangelogDate("20241031033810")
entity Notification {
  date Instant required
  details String
  sentDate Instant required
  format NotificationType required
  userId Long required
  productId Long required
}

enum Gender {
  MALE,
  FEMALE,
  OTHER
}
enum Size {
  S,
  M,
  L,
  XL,
  XXL
}
enum OrderStatus {
  COMPLETED,
  PENDING,
  CANCELLED
}
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
}

paginate Customer, Product, ProductOrder, OrderItem, Invoice, Shipment with pagination
service Customer, Product, ProductCategory, ProductOrder, OrderItem, Invoice, Shipment with serviceClass
search Customer, Product, ProductCategory, ProductOrder, OrderItem, Invoice, Shipment, Notification with no
microservice Product, ProductCategory, ProductOrder, OrderItem with product
microservice Invoice, Shipment with invoice
microservice Notification with notification
clientRootFolder Product, ProductCategory, ProductOrder, OrderItem with product
clientRootFolder Invoice, Shipment with invoice
clientRootFolder Notification with notification

Browsers and Operating System

git version = git version 2.45.1.windows.1
git config core.autocrlf = true

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)
@mshima
Copy link
Member

mshima commented Nov 4, 2024

You should use --auto-crlf option.

@flyliu33 flyliu33 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2024
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