[question] Is there a way to skip licenseHeader for legacy files while keeping other formatters active?
- Lingua principale
- Java
- Stelle
- 5.6k
- Fork
- 559
- Merge medio
- 1g 14h
- PR unite (30g)
- 43
Descrizione
**Environment:**
- Java
- Spotless Maven Plugin
**Background**
Our project contains both new and legacy Java files:
- **New files** contain only the new license header:
```java
// New License Header
```
- **Legacy files** contain multiple historical license headers, for example:
```java
// New License Header
// Old License Header
```
**Problem**
When configuring Spotless with:
```xml
${project.basedir}/tools/spotless/license-header.txt
package |import |module
```
Spotless replaces **all** license headers in **all files**, including legacy files that should keep their original headers.
This causes two issues:
1. Legacy files lose their historical license information
2. If I exclude legacy files from `licenseHeader`, then other formatters (`googleJavaFormat`, `eclipse`, `prettier`, `idea`, `tableTestFormatter`, `importOrder`) will also stop applying to them
**Expected Behavior**
- New files should receive the new license header
- Legacy files should **keep their existing headers**, but still be formatted by other Spotless steps
**Question**
Is there a recommended way to configure Spotless so that:
- `licenseHeader` applies **only to new files**
- Other formatters still apply to **all files**
- Legacy files are not modified by the license step
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con la configurazione di Maven Spotless e il delimitatore di licenseHeader mostrati nell’issue, quindi esamina come i passaggi di formattazione elencati vengono applicati ai file Java. Determina se licenseHeader può essere limitato ai nuovi file senza escludere gli altri passaggi; il lavoro è completato quando i nuovi file ricevono l’header, gli header esistenti rimangono invariati e tutti gli altri formatter continuano a essere eseguiti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- build-system, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100