{"id":1670,"date":"2024-12-11T14:37:35","date_gmt":"2024-12-11T06:37:35","guid":{"rendered":"https:\/\/www.fanyamin.com\/wordpress\/?p=1670"},"modified":"2024-12-11T14:41:22","modified_gmt":"2024-12-11T06:41:22","slug":"1670","status":"publish","type":"post","link":"https:\/\/www.fanyamin.com\/wordpress\/?p=1670","title":{"rendered":"Prettier for java"},"content":{"rendered":"<h2>Overview<\/h2>\n<p>Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.<\/p>\n<p>A Prettier plugin must first parse the source code of the target language into a traversable data structure (Usually an Abstract Syntax Tree) and then print out that data structure in a &quot;pretty&quot; style.<\/p>\n<p>Prettier-Java uses a Java-Parser implemented in JavaScript using the Chevrotain Parser Building Toolkit for JavaScript. What this means is that unlike many other Prettier plugins, prettier-java has no additional runtime pre-requisites (e.g: Python executable). It could even be used inside a browser.<\/p>\n<h2>maven usage<\/h2>\n<pre><code>&lt;build&gt;\n  &lt;plugins&gt;\n    &lt;plugin&gt;\n      &lt;groupId&gt;com.hubspot.maven.plugins&lt;\/groupId&gt;\n        &lt;artifactId&gt;prettier-maven-plugin&lt;\/artifactId&gt;\n        &lt;!-- Find the latest version at https:\/\/github.com\/jhipster\/prettier-java\/releases --&gt;\n        &lt;version&gt;0.8&lt;\/version&gt;\n    &lt;\/plugin&gt;\n  &lt;\/plugins&gt;\n&lt;\/build&gt;<\/code><\/pre>\n<h2>Reference<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/jhipster\/prettier-java\">prettier-java in github<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/jhipster\/prettier-java\/blob\/main\/docs\/advanced_usage.md\">advanced_usage<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Overview Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary. A Prettier plugin must first parse the source code of the target language into a traversable data structure (Usually an [&hellip;] <a class=\"read-more\" href=\"https:\/\/www.fanyamin.com\/wordpress\/?p=1670\" title=\"Permanent Link to: Prettier for java\">&rarr;Read&nbsp;more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1670","post","type-post","status-publish","format-standard","hentry","category-5"],"_links":{"self":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1670"}],"collection":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1670"}],"version-history":[{"count":3,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1670\/revisions"}],"predecessor-version":[{"id":1673,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1670\/revisions\/1673"}],"wp:attachment":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}