LoginSignup
2
2

More than 5 years have passed since last update.

Mavenのexcludesの設定で正規表現を使う方法

Last updated at Posted at 2013-10-22

はじめに

maven-pmd-pluginexcludesの設定をしていたら、

.*Dao.java : 含めたくない
.*APIDao.java : 含めたい

みたいな状況になって、FileSetでしか指定できないかと思ったら、正規表現でも設定できたって話。

こうやる


...
<excludes>
    <!-- %regex[PATTERN]で指定してあげる -->
    <exclude>%regex[^(?!.*API).*Dao\.java$]</exclude>
    <!-- もちろん、FileSetでも指定可能 -->
    <exclude>**/*Test.java</exclude>
 </excludes>
...

注意

公式的には、

Can contain Ant-style wildcards and double wildcards.

と記載されているので、自己責任で。

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