<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ababy003</title>
    <description>The latest articles on DEV Community by ababy003 (@ababy003).</description>
    <link>https://dev.to/ababy003</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F545781%2F2269558e-d830-4166-b5e4-3ea9841d33be.jpeg</url>
      <title>DEV Community: ababy003</title>
      <link>https://dev.to/ababy003</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ababy003"/>
    <language>en</language>
    <item>
      <title>Use formatter-maven-plugin to format source code</title>
      <dc:creator>ababy003</dc:creator>
      <pubDate>Wed, 23 Dec 2020 08:56:25 +0000</pubDate>
      <link>https://dev.to/ababy003/use-formatter-maven-plugin-to-format-source-code-37ah</link>
      <guid>https://dev.to/ababy003/use-formatter-maven-plugin-to-format-source-code-37ah</guid>
      <description>&lt;h3&gt;
  
  
  Write first
&lt;/h3&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;I believe everyone must be familiar with the coding style. Everyone has their own coding style and follows certain specifications, which is undoubtedly a good thing for themselves; but it may be a big trouble for teamwork! Their different styles will lead to unnecessary conflicts and troubles when synchronizing code. Therefore, it is particularly important to unify the code style within the team. Today I recommend a plug-in, you only need to execute the maven command to format the code according to the established style.&lt;/p&gt;

&lt;h3&gt;
  
  
  Official website
&lt;/h3&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://code.revelc.net/formatter-maven-plugin/"&gt;&lt;/a&gt;&lt;a href="https://code.revelc.net/formatter-maven-plugin/"&gt;https://code.revelc.net/formatter-maven-plugin/&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Environmental
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;JDK 1.8+&lt;/li&gt;
&lt;li&gt;Maven 3.3.9+&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  pom.xml Configuration
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;project&amp;gt;
    ...
    &amp;lt;plugins&amp;gt;
      &amp;lt;plugin&amp;gt;
        &amp;lt;groupId&amp;gt;net.revelc.code.formatter&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;formatter-maven-plugin&amp;lt;/artifactId&amp;gt;
        &amp;lt;version&amp;gt;2.11.0&amp;lt;/version&amp;gt;
      &amp;lt;/plugin&amp;gt;
    &amp;lt;/plugins&amp;gt;
    ...
&amp;lt;/project&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the command: mvn formatter:format to perform formatting.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to format source files during build ?
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;project&amp;gt;
    ...
    &amp;lt;plugins&amp;gt;
      &amp;lt;plugin&amp;gt;
        &amp;lt;groupId&amp;gt;net.revelc.code.formatter&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;formatter-maven-plugin&amp;lt;/artifactId&amp;gt;
        &amp;lt;version&amp;gt;2.11.0&amp;lt;/version&amp;gt;
        &amp;lt;executions&amp;gt;
          &amp;lt;execution&amp;gt;
            &amp;lt;goals&amp;gt;
              &amp;lt;goal&amp;gt;format&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
          &amp;lt;/execution&amp;gt;
        &amp;lt;/executions&amp;gt;
      &amp;lt;/plugin&amp;gt;
    &amp;lt;/plugins&amp;gt;
    ...
&amp;lt;/project&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;project&amp;gt;
    ...
    &amp;lt;plugins&amp;gt;
      &amp;lt;plugin&amp;gt;
        &amp;lt;groupId&amp;gt;net.revelc.code.formatter&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;formatter-maven-plugin&amp;lt;/artifactId&amp;gt;
        &amp;lt;version&amp;gt;2.11.0&amp;lt;/version&amp;gt;
        &amp;lt;executions&amp;gt;
          &amp;lt;execution&amp;gt;
            &amp;lt;goals&amp;gt;
              &amp;lt;goal&amp;gt;validate&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
          &amp;lt;/execution&amp;gt;
        &amp;lt;/executions&amp;gt;
      &amp;lt;/plugin&amp;gt;
    &amp;lt;/plugins&amp;gt;
    ...
&amp;lt;/project&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.jsonformatting.com/jsonformat"&gt;JSON FORMATTER&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
