Maven配置

Maven是一个项目管理工具,用于项目的构建,

安装maven后操作:

1.配置环境变量: 在"path"加入maven安装路径: D:\software\maven-3.0.3\bin

2.配置路径:

(1)在 D:\software\maven-3.0.3\conf 中修改settings.xml文件中,m2路径的配置。比如我的代码路径是E:\work\projectcode。settings.xml中设置 <localRepository>E:\work\projectcode\.m2\repository</localRepository>

3.执行mvn命令:

(1).进入代码路径

(2).mvn clean

(3).mvn -Pfast install

ps:在执行的时候报错:[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin

:[ERROR]Failure executing javac.

发现是由于 setting文件中有设置JAVA_1_8_HOME,但是本地却没有安装。

<profile> <id>compiler</id> <properties> <JAVA_1_8_HOME></JAVA_1_8_HOME> </properties> </profile>

 (4). mvn eclipse:eclipse

4.eclipse配置

不能截图啊,只能文字说明了。

window -> Preferences -> Maven ->User Settings

配置 user settings 为 D:\software\maven-3.0.3\conf\settings.xml,apply即可。

继而在Java -> Build Path -> Classpath Variables 中可查看到 M2_REPO 变量路径已修改为上述配置路径。

5.导入全部工程

File—〉Import...;选择General—〉Existing Projects into Workspace,设置Select root directory为你的E:\work\projectcode。

posted on 2016-10-11 16:37  丹偌心  阅读(117)  评论(0)    收藏  举报

导航