Maven 以外のプロジェクトを持っていますが、Sonar を使用してコード分析を 1 回行う必要があります。だから私はpom.xml
素晴らしい作品を作成しました。src
このpomファイルを使用して、ディレクトリの下にあるすべてのファイルとフォルダーの分析を確認します。
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>my.group.id</groupId>
<artifactId>arifactId</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>MyApplication</name>
<build>
<sourceDirectory>src</sourceDirectory>
</build>
<properties>
<sonar.dynamicAnalysis>false</sonar.dynamicAnalysis>
</properties>
</project>
しかし、1 つのディレクトリとそのすべてのサブディレクトリを除外したいと考えています。と の 2 つのディレクトリがsrc/fr/
ありsrc/com/
ます。src/fr/
私は持って除外したいだけですsrc/com/
。変化
<sourceDirectory>src</sourceDirectory>
に
<sourceDirectory>src/fr</sourceDirectory>
次のエラーが表示されます。
Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar
(default-cli) on project arifactId: Can not execute Sonar: Sonar is
unable to analyze file : '/Users/tim/workspace/src/fr/xxx/dao/TestClass.java':
The source directory does not correspond to the package declaration fr.xxx.dao