Maven項目解決Remove '@override' annotation終極方案

特別提示:本人博客部分有參考網絡其餘博客,但均是本人親手編寫過並驗證經過。如發現博客有錯誤,請及時提出以避免誤導其餘人,謝謝!歡迎轉載,但記得標明文章出處: http://www.cnblogs.com/mao2080/

一、問題描述

  當類實現接口後,點擊自動實現接口方法時,會自動加上@override,但因爲編譯環境文件有錯誤,提示Remove '@override' annotation,網上找了些方法只能臨時解決,不能完全解決問題。好比修改:html

  一、Project->Properties->Project Facets->Java 1.7apache

  二、Project->Properties->Java Compiler 1.7網絡

  當刷新maven(Alt+F5)項目時,這些修改的又回到了初始狀態。maven

二、解決方法

在pom.xml中添加以下配置,而後右鍵Maven->Update project:ide

<build>
		<plugins>
			<!-- jdk版本號 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
		</plugins>
	</build>

  

相關文章
相關標籤/搜索