maven管理整理

学习了:https://www.imooc.com/learn/443

mvn -v      版本
compile 编译
test 测试
package 打包 clean 删除
install 安装jar包到本地仓库 创建目录的两种方式:
1,archetype:generate 按照提示进行选择
2,archetype:generate -DgroupId=组织名,公司网址反写+项目名
-DartifactId=项目名-模块名
-Dversion=版本号
-Dpackage=包名 镜像仓库 pom.xml元素:
project
modelVersion 指定当前pom的版本
groupId 反写的公司网址+项目名
artifactId 项目名+模块名
version 第一个0表示大版本号,第二个0表示分支版本号,第三个0表示小版本号
0.0.1-SNAPSHOT,alpha内部测试, beta公测, release稳定, GA
packaging 默认是jar,还有war zip pom
name 项目描述名
url 项目地址
description 项目描述
developers 开发任意列表
licenses 许可证信息
organization 组织信息 dependencies 依赖列表
dependency 依赖项
groupId
artifactId
version
type
scope test只在测试代码范围有用
optional true/false 设置依赖是否可选
exclusions 排除依赖传递列表
exclusion
dependencyManagement 依赖管理,一般用于父模块
dependencies 依赖列表
dependency
build
plugins 插件列表
plugin 插件
groupId
artifactId
version
parent 子模块中对父模块的继承
modules 多个子模块一起编译 maven依赖范围 http://maven.apache.org/ compile/provided/runtime/test/system/import 修改默认的maven编译等级,修改settings,增加profile
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile> maven依赖:短路优先、先声明优先 web项目:
archetype web-app
pom中增加servlet
junit 版本改为4.10
创建source folder
确保output
project facets -> 选择动态模块
deployment assembly -> 删除test/resources
在build中加入jetty maven的插件
mvn build... 运行jetty:run
可以指定package的时候运行

pom:

<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>com.imooc.webdemo</groupId>
<artifactId>webdemo2</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>webdemo2 Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>webdemo2</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<!--
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.16.v20140903</version>
resin这个还是有问题的
<groupId>com.caucho</groupId>
<artifactId>resin</artifactId>
<version>3.0.9</version>
-->
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

maven管理整理的更多相关文章

  1. Maven管理 划分模块

    转载地址:juvenshun.iteye.com/blog/305865 “分天下为三十六郡,郡置守,尉,监” —— <史记·秦始皇本纪> 所有用Maven管理的真实的项目都应该是分模块的 ...

  2. java传统web项目添加maven管理jar包,log4j无法正常输出日志

    本文适合1年以上编程基础的开发人员阅读,非技术创新,可作为故障排除实录参考/收藏. 背景 笔者最近在给公司一个老的web项目改造升级,项目使用springmvc+mybatis,由于项目比较久远,没有 ...

  3. IntelliJ IDEA 开发工具项目maven管理

    今天自己重新部署一下intellij下的项目开发环境,顺便把maven管理项目jar包的方法梳理一下 (1)首先下载apache-maven-3.0.4版本的maven,我自己解压在D:\maven\ ...

  4. Maven管理项目架包

    最近一直在用Maven管理项目的架包,从而发现了几个不错的官方或者非官方的网站. http://mvnrepository.com/artifact/com.ning  这个是我刚刚用来找HTTP开发 ...

  5. 对于Maven管理的项目制定虚拟目录

    基于Maven管理的web项目结构: target目录是用来存放项目打包之后生成的文件的目录,此目录中的文件必须调用mvn clean package后才能生成, 如果把虚拟目录设置在此目录中,则每次 ...

  6. maven管理的项目出现Error configuring application listener of class org.springframework.web.context.ContextL

    eclipse里用maven管理的项目,在运行的时候出现 Error configuring application listener of class org.springframework.web ...

  7. 使用Maven管理Spring

    原文链接: Spring with Maven原文日期: 2013年04月17日翻译日期: 2014年06月29日翻译人员: 铁锚 1. 概述本教程向您展示怎样通过 Maven 管理 Spring 的 ...

  8. 使用Maven管理Spring[转]

    原文链接: Spring with Maven 原文日期: 2013年04月17日 翻译日期: 2014年06月29日 翻译人员: 铁锚 翻译原文连接:http://blog.csdn.net/ren ...

  9. 使用maven管理后,依然找不到需要的jar包

    使用maven管理后,依然报错,找不到,比如如下错误java.lang.ClassNotFoundException: org.springframework.web.context.ContextL ...

随机推荐

  1. iBATIS 框架主要的类层次结构

    iBATIS 框架主要的类层次结构 总体来说 iBATIS 的系统结构还是比较简单的,它主要完成两件事情: 根据 JDBC 规范建立与数据库的连接: 通过反射打通 Java 对象与数据库参数交互之间相 ...

  2. Unity 3D 的四种坐标系

    1, World Space(世界坐标): 我们在场景中添加物体(如:Cube),他们都是以世界坐标显示在场景中的.transform.position可以获得该位置坐标. 2, Screen Spa ...

  3. 指定某个git的版本代码拉取新的分支

    在本地找到一个目录,执行 git clone http://gitlab.xxxxx.com/xxxxx/xxxxx.git cd xxxxx/ git log //找到对应版本的SHA值 例如2b1 ...

  4. P1463 [HAOI2007]反素数

    题目描述 对于任何正整数x,其约数的个数记作g(x).例如g(1)=1.g(6)=4. 如果某个正整数x满足:g(x)>g(i) 0<i<x,则称x为反质数.例如,整数1,2,4,6 ...

  5. MSP430之自动增益程控放大main备份

    占位符 #include <msp430.h> #include "sys.h" #include "ps2.h" #include "1 ...

  6. Java语法糖(二)

    语法糖之四:内部类 内部类:顾名思义,在类的内部在定义一个类.内部类仅仅是编译时的概念,编译成字节码后,内部类会生成单独的Class文件. 四种:成员内部类.局部内部类.匿名内部类.静态内部类. 1. ...

  7. VijosP1303 导弹拦截

    背景 实中编程者联盟为了培养技术精湛的后备人才,必须从基础题开始训练. 描述 某国为了防御敌国的导弹袭击,研发出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度, ...

  8. 30+ Excellent Windows Phone 7 Development Tutorials

    原文发布时间为:2012-01-16 -- 来源于本人的百度文章 [由搬家工具导入] Here are 30+ cool Windows Phone Development articles for ...

  9. 不用框架使用ajax 纯js使用ajax post,get范例及其区别

    原文发布时间为:2009-11-15 -- 来源于本人的百度文章 [由搬家工具导入] 不用框架使用ajax 纯js使用ajax post,get范例及其区别 ===================== ...

  10. socket介绍(webService适用场景)

    1.使用场景         - 不同的移动客户端访问      - 需要访问第三方的项目 2.访问第三方应用的方式      ISO的七层模型  : 物理层.数据链路层.网络层.传输层.表示层.会话 ...