初步尝试Maven
1.Unable to locate the Javac Compiler
?
Window -> Preferences -> Java -> Installed JREs, 点击"Add"按钮,选择默认的"Standard VM", 点击"Next >", 点击"JRE home"右边的"Directory"选择文件夹D:\Development\Java\jdk1.5.0_16,一路“确定”,回 到"Installed JREs"界面,在刚添加的"jdk1.5.0_16"打上勾。再选择目录树中的"Execution Environments", 点选界面左侧的"J2SE-1.6",然后在右侧点选"jdk1.6.0_16"。另外,在这之前,我还在eclipse.ini文件中加了两行(一定要加在-vmargs之前,而且-vm后面有回车):-vm2.解决maven与eclipse中@override出现must override a superclass method错误
想到《Maven in action》中maven的核心插件complier默认只支持java1.3,我们需要配置该插件使其支持java1.6(因为@Override在1.5中只适用重写父类方法,1.6中适用实现接口)
在maven配置文件pom.xml中添加
?
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.1</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin>?
相信在eclipse中使用maven的人都装了m2eclipse插件,在项目上右击选择maven-> Update Project Configuration。