1. 程式人生 > >【maven 錯誤解決】@Override is not allowed when implement interface method

【maven 錯誤解決】@Override is not allowed when implement interface method

Intellij IDEA,有時候 @Override卻顯紅編譯不通過。

解決方法:

由於我的專案是maven型別專案,所以在pox.xml的標籤中新增如下程式碼,即可解決問題。

<build>
        <plugins>
            <!-- 編碼和編譯和JDK版本 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>utf8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>