私は、spring-data-neo4j Maven 依存関係を、maven-compiler-plugin と Xlint および -Werror フラグを使用するプロジェクトに統合する任務を負っています。修正が必要なコンパイルの問題がいくつかあります。
spring-data-neo4j とこのビルド構成に依存する Maven プロジェクトをビルドすると、ビルドが失敗する原因となるコンパイル警告が発行されます。このプロジェクトのビルド構成を自由に変更することはできないため、コンパイラの警告を排除する方法を見つけようとしています。
http://github.com/spring-guides/gs-accessing-data-neo4jプロジェクトをhttps://github.com/spencerhrob/gs-accessing-data-neo4jにフォークして問題を再現しました。
with-xlintブランチでは、pom.xml ファイルの「build」セクションが次のように変更されました。
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<debug>true</debug>
<compilerArguments>
<Xlint/>
<Werror />
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
このブランチの完全なフォルダーでmvn clean packageを実行すると、次のコンパイル エラーが返されます。
[WARNING] COMPILATION WARNING :
[INFO]-------------------------------------------------------------
[WARNING] No processor claimed any of these annotations: org.springframework.context.annotation.Bean, org.springframework.data.neo4j.config.EnableNeo4jRepositories, org.springframework.data.neo4j.annotation.NodeEntity,org.springframework.data.neo4j.annotation.GraphId,org.springframework.data.neo4j.annotation.RelatedTo,org.springframework.data.neo4j.annotation.Fetch,org.springframework.context.annotation.Configuration,org.springframework.beans.factory.annotation.Autowired
[INFO] 1 warning
[INFO]-------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO]-------------------------------------------------------------
[ERROR] warnings found and -Werror specified [INFO] 1 error
-Xlint フラグを削除すると ( with-xlintブランチのように)、コンパイラの警告が発行されなくなります。また、(with -werrorブランチのように) -Werror フラグを削除すると、警告が発行されますが、Maven ビルドは引き続き正常に完了します。
また、親の gs-accessing-data-neo4j プロジェクトで使用されているように、spring-boot-maven-plugin ビルド プラグインで Xlint を使用してみました。私のリポジトリのwithout-maven-compiler-pluginブランチには、次の構成があります。
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<debug>true</debug>
<compilerArguments>
<Xlint/>
<Werror />
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
このブランチでmvn clean packageを実行すると、コンパイラの引数で Xlint が指定されていても、コンパイラの警告は返されません (ただし、Xlint が実行されているかどうかは完全にはわかりません)。
maven-compiler-plugin を削除するか、-Xlint または -Werror フラグを削除することでこの問題を解決できることはわかっていますが、作業中のプロジェクトのビルド構成を変更できないため、それはオプションではありません。 on (参照されている GitHub リポジトリではありません)。
-Xlint および -Werror フラグを指定して maven-compiler-plugin を使用して spring-data-neo4j 依存プロジェクトをビルドすると、「プロセッサがこれらの注釈のいずれかを要求していません」というコンパイラ警告が発生する既知の理由はありますか? また、maven-compiler-plugin または -Xlint および -Werror フラグを削除せずにコンパイラの警告をなくす方法はありますか?