您的位置:首页 > 编程语言 > Java开发

java项目,配置maven,编译项目

2013-11-27 14:39 363 查看
1、安装maven,例如安装路径 D:\jianing\ToolsInstallation\Java开发工具\apache-maven-2.2.1

2、在环境变量里配置maven路径,(Win7)控制面板->用户账户->更改我的环境变量->系统环境:建立环境变量MAVEN_HOME,赋值:D:\jianing\ToolsInstallation\Java开发工具\apache-maven-2.2.1

3、在文件夹D:\jianing\ToolsInstallation\Java开发工具\apache-maven-2.2.1\conf里设置setting.xml文件的内容,根据maven服务器的信息进行配置,内容如下:

<?xml version="1.0" encoding="UTF-8"?>

<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<profiles>

<profile>

<repositories>

<repository>

<snapshots>

<enabled>false</enabled>

</snapshots>

<id>central</id>

<name>libs-releases</name>

<url>http://artifactory.xxx-develop.com/libs-releases</url>

</repository>

<repository>

<snapshots />

<id>snapshots</id>

<name>libs-snapshots</name>

<url>http://artifactory.xxx-develop.com/libs-snapshots</url>

</repository>

</repositories>

<pluginRepositories>

<pluginRepository>

<snapshots>

<enabled>false</enabled>

</snapshots>

<id>central</id>

<name>plugins-releases</name>

<url>http://artifactory.xxx-develop.com/plugins-releases</url>

</pluginRepository>

<pluginRepository>

<snapshots />

<id>snapshots</id>

<name>plugins-snapshots</name>

<url>http://artifactory.xxx-develop.com/plugins-snapshots</url>

</pluginRepository>

</pluginRepositories>

<id>artifactory</id>

</profile>

</profiles>

<activeProfiles>

<activeProfile>artifactory</activeProfile>

</activeProfiles>

</settings>

4、在IDEA 里设置setting.xml配置路径,File -> Settings -> Maven ->User settings file: "D:\jianing\ToolsInstallation\Java开发工具\apache-maven-2.2.1\conf\settings.xml"

编译: 右边Maven Projects -> Profiles下面,勾选 artifactory 和 dev-publish, 只需要clean和compile 项目PROJECTname(root)即可。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: