maven安装配置
来源:互联网 发布:新闻网站数据采集系统 编辑:程序博客网 时间:2024/04/28 01:27
1、到http://maven.apache.org/download.cgi下载最新版本的maven。
2、解压apache-maven-3.3.9到相应的安装目录(D:\Program Files\apache-maven-3.3.9)。
3、配置环境变量 新建环境变量 M2_HOME=D:\Program Files\apache-maven-3.3.9(MAVEN安装目录)。把bin文件夹目录添加到path中。
4、验证是否安装上 命令行下输入mvn -v
出现版本信息即为正确安装
在eclipse里配置:windows-preferences-maven-installations 和user setting 中设置maven目录和本地仓库目录
并且在jdk的
Default VM arguments中设置
-Dmaven.multiModuleProjectDirectory=$M2_HOME
要注意jdk和maven的版本是否对应
使用maven-assembly-plugin打包:
1.在pom.xml中加入 红色标注部分
<span style="color:#333333;"><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/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>neu.bigdate.ali</groupId><artifactId>test2</artifactId><version>0.0.1-SNAPSHOT</version><packaging>jar</packaging><name>test2</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>3.8.1</version><scope>test</scope></dependency><dependency><groupId>com.aliyun.odps</groupId><artifactId>odps-sdk-mapred</artifactId><version>0.19.3-public</version></dependency></dependencies></span><span style="color:#ff0000;"><build><plugins><plugin><artifactId>maven-assembly-plugin</artifactId><version>2.4.1</version><configuration><finalName>mylib</finalName><appendAssemblyId>false</appendAssemblyId><encoding>utf-8</encoding><descriptors><descriptor>src/main/assembly/src.xml</descriptor></descriptors><descriptorRefs><descriptorRef>jar-with-dependencies</descriptorRef></descriptorRefs></configuration><executions><execution><id>make-assembly</id><phase>package</phase><goals><goal>single</goal></goals></execution></executions></plugin></plugins></build></span><span style="color:#333333;"></project></span>
2.在src/main/assembly/路径下创建src.xml(上一步红色部分设置的路径)
src.xml中内容
<?xml version="1.0" encoding="UTF-8"?> <assembly 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/xsd/assembly-1.0.0.xsd"> <id>package</id> <formats> <format>war</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <!-- <fileSets> <fileSet> <directory>src/main/bin</directory> <outputDirectory>/</outputDirectory> </fileSet> <fileSet> <directory>src/main/config</directory> <outputDirectory>config</outputDirectory> </fileSet> </fileSets> --> <dependencySets> <dependencySet> <outputDirectory>lib</outputDirectory> <scope>runtime</scope> </dependencySet> </dependencySets> </assembly>
3.mvn assembly:assembly构建
0 0
- maven安装 eclipse配置maven
- 【Maven】Maven 安装与配置
- Maven安装配置
- Maven安装与配置
- Maven安装配置
- Ubuntu Maven安装配置
- Maven安装与配置
- Maven安装与配置
- Maven - 安装 配置
- Maven安装与配置
- Maven安装与配置
- maven安装及配置
- Maven安装、配置、使用
- (1)Maven安装配置
- maven安装配置
- maven 安装与配置
- Maven安装配置
- Maven安装配置
- 实现循环调用系统的震动或者单次调用
- 【Android】android:padding属性设置对ImageButton无效问题
- Vasya and Socks
- 初识c语言
- java后台发起请求方式
- maven安装配置
- js对象化编程
- OpenCV3的GPU模块编译
- checkbox操作
- hdu1247+hdu1075 字典树基础
- 100%色域
- Hibernate——1+N问题
- 图——应用图的广度优先遍历思路求解问题
- 不念过去,不畏将来