Maven环境的搭建与idea配置
2015-09-12 21:28
686 查看
Maven环境的搭建与idea配置
Maven 下载: http://maven.apache.org/download.cgi
Maven 中央仓库地址:http://search.maven.org
配置maven环境变量
M2_HOME:D:\workspace\maven\apache-maven-3.0.5
Path:;%M2_HOME%/bin;
检查是否成功,打开CMD:
Mvn -v
mvn install 会将项目生成的构件安装到本地Maven仓库
mvn deploy 用来将项目生成的构件分发到远程Maven仓库
D:\>mvn archetype:generate:在D:盘构建maven标准项目目录结构
2、settings.xml文件配置
2.0修改本地仓库位置
M2_home目录下 conf/settings.xml
[html] view
plaincopy
<localRepository>D:/workspace/maven/stone</localRepository>
2.1如何配置远程仓库(私服): (nexus-2.0.4-1-bundle)
[html] view
plaincopy
<profiles>
<profile>
<id>nexus</id>
<repositories><!--配置远程仓库-->
<repository>
<id>nexus</id>
<name>Central Repository</name>
<url>http://127.0.0.1/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled><!---->
</snapshots>
</repository>
</repositories>
<pluginRepositories><!--配置Maven从什么地方下载插件构件-->
<pluginRepository>
<id>nexus</id>
<name>Central Repository</name>
<url>http://127.0.0.1/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles><!--激活 远程仓库-->
<activeProfile>nexus</activeProfile>
</activeProfiles>
-------------------------------------------------------------------------------------------------
2.2还可以配置仓库的镜像下载
[html] view
plaincopy
<mirrors>
<mirror><!--配置镜像-->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://127.0.0.1/nexus/content/groups/public</url>
</mirror>
</mirrors>
3、pom.xml文件配置依赖
[html] view
plaincopy
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xu.feifei</groupId>
<artifactId>feifei</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
</dependencies>
<build>
<finalName>feifei</finalName>
</build>
</project>
二、IDEA的搭建Maven相关配置
.
maven项目的包结构
设置maven自动导包
Maven 下载: http://maven.apache.org/download.cgi
Maven 中央仓库地址:http://search.maven.org
配置maven环境变量
M2_HOME:D:\workspace\maven\apache-maven-3.0.5
Path:;%M2_HOME%/bin;
检查是否成功,打开CMD:
Mvn -v
mvn install 会将项目生成的构件安装到本地Maven仓库
mvn deploy 用来将项目生成的构件分发到远程Maven仓库
D:\>mvn archetype:generate:在D:盘构建maven标准项目目录结构
2、settings.xml文件配置
2.0修改本地仓库位置
M2_home目录下 conf/settings.xml
[html] view
plaincopy
<localRepository>D:/workspace/maven/stone</localRepository>
2.1如何配置远程仓库(私服): (nexus-2.0.4-1-bundle)
[html] view
plaincopy
<profiles>
<profile>
<id>nexus</id>
<repositories><!--配置远程仓库-->
<repository>
<id>nexus</id>
<name>Central Repository</name>
<url>http://127.0.0.1/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled><!---->
</snapshots>
</repository>
</repositories>
<pluginRepositories><!--配置Maven从什么地方下载插件构件-->
<pluginRepository>
<id>nexus</id>
<name>Central Repository</name>
<url>http://127.0.0.1/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles><!--激活 远程仓库-->
<activeProfile>nexus</activeProfile>
</activeProfiles>
-------------------------------------------------------------------------------------------------
2.2还可以配置仓库的镜像下载
[html] view
plaincopy
<mirrors>
<mirror><!--配置镜像-->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://127.0.0.1/nexus/content/groups/public</url>
</mirror>
</mirrors>
3、pom.xml文件配置依赖
[html] view
plaincopy
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xu.feifei</groupId>
<artifactId>feifei</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
</dependencies>
<build>
<finalName>feifei</finalName>
</build>
</project>
二、IDEA的搭建Maven相关配置
.
maven项目的包结构
设置maven自动导包
相关文章推荐
- Struts基本开发搭建步骤-总结
- 笔记
- 简单的区间覆盖问题
- 栈——(1)栈的顺序存储
- mantis使用知识总结
- Integer to Roman and Roman to Integer
- 假如(信乐团)
- 扑克排序,按花色、值排序(2015年9月10日)
- VS2010+WDK开发环境搭建最简易方法
- DIV+CSS布局门户网站
- python简单爬虫例子(一)
- 连续论域模糊控制,博途1200程序代码
- 杭州电子科技大学acm--2016
- 求原始矩阵逆时针旋转90度后的矩阵(CCF)
- Linux下运行C++程序出现"段错误(核心已转储)"的原因
- 如果看了此文你还不懂傅里叶变换,那就过来掐死我吧【完整版】
- JS的onerror事件
- 莫队算法 sqrt(n)分块思想
- Android Studio中使用*.jar,*.aar和*.so文件
- JS数据类型之Math对象