My pom.xml
is messy, having collected cruft over time. Is there any automated way to "clean up" a pom? Like a linter but for maven.
In IntelliJ I can run Analyze > Inspect Code
and get a list of unused functions, silly iterators, and probable bugs. I think I'm looking for the same thing for my pom
mvn versions:display-dependency-updates
works, but doesn't restrict to non-breaking version updates) For a simple static analysis of your pom.xml
, you can use the lint-maven-plugin .
pom.xml
:<build>
<plugins>
<plugin>
<groupId>com.lewisd</groupId>
<artifactId>lint-maven-plugin</artifactId>
<version>0.0.11</version>
</plugin>
</plugins>
</build>
lint:check
goal to check your pom.xml
for violations.$ mvn lint:check
The plugin will report any violations in your pom.xml
as demonstrated below.
[INFO] --- lint-maven-plugin:0.0.11:check (default-cli) @ maven-sample ---
[INFO] Writing summary report
[INFO] [LINT] Completed with 3 violations
[INFO] [LINT] OSSDevelopersSectionRule: missing <developers/> section : 0:0 : /Users/jdoe/workspace/maven-sample/pom.xml
[INFO] [LINT] OSSInceptionYearRule: missing <inceptionYear/> information : 0:0 : /Users/jdoe/workspace/maven-sample/pom.xml
[INFO] [LINT] GAVOrder: Found 'name' but was expecting 'packaging' : 19:8 : /Users/jdoe/workspace/maven-sample/pom.xml
You can see a list of available rules by running the lint:list
goal.
Sounds like there isn't a pom.xml linter like jshint.com that I can paste my pom into and get advice out.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.