0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

STS(Eclipse)でJavaフォーマッタを設定する

Posted at
  1. 準備:プロジェクト内にconfigフォルダを作成
  2. フォーマッタファイルを作成(https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xmlから取得)
  3. メニューバーから Window > Preferences を選択
  4. Java > Code Style > Formatterを選択し、Importボタンから準備したformatter.xmlを選択し、Applyボタンを押す
    image.png
  5. Ctrl+Shift+Fでフォーマッタが機能することを確認
    image.png
    ↓実行後、タブがスペース2個になるなど変化している
    image.png
    ーーー
    CheckStyleも設定する
    STSに入っていなかったため、Eclipse Marketplaceからプラグインをインストール
    image.png
    インストールするに際してコンテンツを信用するか質問される
    image.png
    image.png
    STS再起動後プロジェクトを左クリックするとCheckStyleが確認できた
    image.png
    CheckStyleのGitHubページからEclipseプラグインのバージョンと一致するソースコードを取得し、 src/main/resources/google_checks.xmlをコピーする
    https://github.com/checkstyle/checkstyle/releases

主なソース
https://tetsufuru.hatenablog.com/entry/2021/03/19/232020

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?