maven 設定jdk版本
阿新 • • 發佈:2018-11-22
方式一:settings.xml 配置 開啟 %maven%/conf/settings.xml 檔案並編輯它(%maven% 表示 maven 的根目錄) : <profiles> <profile> <id>development</id> <activation> <jdk>1.7</jdk> <activeByDefault>true</activeByDefault> </activation> <properties> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion> </properties> </profile> </profiles> 找到 <profiles> 節點,並新增如上配置(本機 jdk 1.7.0_79 版本,配置時修改成你本機的 jdk 版本)。儲存並關閉。重啟 eclipse 即可。 重啟後配置生效。 方式二:pom.xml 配置 在 <build> 節點新增如下配置(本機 jdk 1.7.0_79 版本,配置時修改成你本機的 jdk 版本): <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> </build> 本人側重於第二種