Spring -data-neo4j with maven-compiler-plugin and xlint causes compiler warning

I was tasked with integrating the spring -data-neo4j Maven dependency into a project that uses the maven-compiler-plugin with Xlint and the -Werror flag. I'm having compilation issues that I need to fix.

Building a Maven project based on spring -data-neo4j and this build configuration causes a compilation warning, which leads to a build failure. I cannot change the build configuration of this project, so I am trying to find a way to resolve the compiler warning.

I reproduced the problem by turning the project http://github.com/spring-guides/gs-accessing-data-neo4j to https://github.com/spencerhrob/gs-accessing-data-neo4j .

In the c-xlint branch, the assembly section of the pom.xml file has been changed to the following:

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

Running mvn of a clean package in the full folder in this branch returns the following compilation error:

[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

Removing the -Xlint flag (as in a branch without -xlint ) predicts that a compiler warning will not be issued. In addition, removing the -Werror flag (as in a branch without a-werror ) generates a warning, but the Maven build still succeeds.

I also tried using Xlint with the spring-boot-maven-plugin build plugin, which is used in the parent gs-accessing-data-neo4j project. The deployment without the -maven-compiler-plugin in my repository has the following configuration:

<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 -Xlint -Werror, , 'm ( GitHub).

, spring -data-neo4j maven-- -Xlint -Werror " , - "? , maven-compiler -Xlint -Werror?

+4

All Articles