LoginSignup
15
15

More than 5 years have passed since last update.

Eclipseのフォーマッタをコマンドラインで実施

Posted at

例) カレントディレクトリ配下の*.javaに対して適用

-> % /Applications/eclipse/eclipse -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -config xxxxxxx/.settings/org.eclipse.jdt.core.prefs `find $(pwd) -name '*.java'`

フォーマット対象ファイルはフルパスじゃないとダメみたいです。
あと、対象外ファイルはgrep -vとかで除けるかと。

使用方法

Usage: eclipse -application org.eclipse.jdt.core.JavaCodeFormatter [ OPTIONS ] -config <configFile> <files>

   <files>   Java source files and/or directories to format.
             Only files ending with .java will be formatted in the given directory.
   -config <configFile> Use the formatting style from the specified properties file.
                        Refer to the help documentation to find out how to generate this file.

 OPTIONS:

   -help                Display this message.
   -quiet               Only print error messages.
   -verbose             Be verbose about the formatting job.

参考

15
15
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
15
15