Eclipse MavenコンパイルエラーDynamic Web Module 3.0 requires Java 1.6 or newerソリューション

3355 ワード

転載先:http://blog.csdn.net/defonds/article/details/47974269
Eclipse Mavenがjeeプロジェクトを開発したとき、コンパイル中に次のエラーが発生しました.
Description ResourcePathLocationType Dynamic Web Module 3.0 requires Java 1.6 or newer. bdp line 1 Maven Java EE Configuration Problem Description ResourcePathLocationType One or more constraints have not been satisfied. bdp line 1 Maven Java EE Configuration Problem
図:
Dynamic Web Module 3.0 requires Java 1.6 or newer
しかし、Eclipseはコンパイルレベルを1.7に設定しているのに:
Eclipse Maven 编译错误 Dynamic Web Module 3.0 requires Java 1.6 or newer 解决方案_第1张图片
これは、あなたのMavenコンパイルレベルがjdk 1.5以下であるためです.jdk 1.6以上の依存パッケージをインポートしました.EclipseのNavigatorビューの下にあるプロジェクトの.classpathファイルを表示します.
[html] view plain
copy
print ?
  
  •       

  •           
  •     attributes>  

  • classpathentry>  
    	
    		
    			
    		
    	

    解決策:
    maven-compiler-pluginを使用して、mavenコンパイルレベルをjdk 1.6以上に変更します.
    [html] view plain
    copy
    print ?
      
  •       

  •           
  •           

  •             org.apache.maven.pluginsgroupId>  
  •             maven-compiler-pluginartifactId>  

  •             2.3.2version>  
  •               

  •                 1.7source>  
  •                 1.7target>  

  •             configuration>  
  •         plugin>  

  •     plugins>  
  • build>  
  • 	
    		
    			
    			
    				org.apache.maven.plugins
    				maven-compiler-plugin
    				2.3.2
    				
    					1.7
    					1.7
    				
    			
    		
    	

    参考資料
  • http://stackoverflow.com/questions/12857535/eclipse-maven-update-causes-corruption-of-jvm-setting
  • http://stackoverflow.com/questions/5783338/what-is-the-use-of-org-eclipse-jdt-launching-jre-container-in-eclipse