본문 바로가기
java/apache-common

아파치 커먼즈(Apache Commons) CLI 예제

by hs_seo 2019. 3. 30.

아파치 커먼즈의 CLI 라이브러리는 프로그램을 실행 할 때 전달하는 옵션값을 파싱하는 라이브러리 입니다. CLI 공식 문서에서 제공하는 Ant 옵션 파싱 예제를 통해 사용방법을 알아보겠습니다.

 

Ant는 다음과 같은 옵션을 가지고 있습니다.

 

ant [options] [target [target2 [target3] ...]]
  Options: 
  -help                  print this message
  -projecthelp         print project help information
  -version              print the version information and exit
  -quiet                 be extra quiet
  -verbose             be extra verbose
  -debug               print debugging information
  -emacs               produce logging information without adornments
  -logfile               use given file for log
  -logger               the class which is to perform logging
  -listener              add an instance of class as a project listener
  -buildfile             use given buildfile
  -D=                   use value for given property
  -find                  search for buildfile towards the root of the filesystem and use it

 

이 옵션을 해석하는 파서는 다음과 같습니다.

 

반응형