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. 深入学习之mysql(二)表的操作

    1.表:是数据库中的存储数据的基本单位,一个表包含若干个字段和值 2.创建表: CREATE TABLE 表名称 ( 字段名1 数据库类型1 [约束条件1], 字段名2 数据库类型2 [约束条件2], ...

  2. maven学习(九)——maven中的坐标、依赖以及仓库

    一.Maven坐标 1.1.什么是坐标? 在平面几何中坐标(x,y)可以标识平面中唯一的一点. 1.2.Maven坐标主要组成 groupId:组织标识(包名) artifactId:项目名称 ver ...

  3. ci日志记录

    log_message($level, $message) 参数: $level (string) -- Log level: 'error', 'debug' or 'info' $message  ...

  4. 习题:八数码难题(双向BFS)

    八数码难题(wikioi1225) [题目描述] 在3×3的棋盘上,摆有八个棋子,每个棋子上标有1至8的某一数字.棋盘中留有一个空格,空格用0来表示.空格周围的棋子可以移到空格中.要求解的问题是:给出 ...

  5. BZOJ3720 Gty的妹子树 【树分块】

    题目 我曾在弦歌之中听过你, 檀板声碎,半出折子戏. 舞榭歌台被风吹去, 岁月深处尚有余音一缕-- Gty神(xian)犇(chong)从来不缺妹子-- 他来到了一棵妹子树下,发现每个妹子有一个美丽度 ...

  6. linux系统——etc下的passwd 文件

    etcpasswd 文件 在登陆时要求输入用户名和密码,就是根据这个来的. root::0:0:root:/root:/bin/bash bin:x:1:1:bin:/dev/null:/bin/fa ...

  7. css中按钮的四种状态

    css中按钮有四种状态 1. 普通状态2. hover 鼠标悬停状态3. active 点击状态4. focus 取得焦点状态 .btn:focus{outline:0;} 可以去除按钮或a标签点击后 ...

  8. tomcat镜像构建

    1.目录结构与配置文件如下 [root@centos05 java]# tree . ├── apache-tomcat-.tar.gz ├── Dockerfile ├── jdk-8u45-lin ...

  9. css iframe边框去掉

    [IE6以下] iframe边框通过css设定在FF下正常在ie下却还存在边框,通过在iframe标签内部设置属性 frameborder="no" border="0& ...

  10. Java EE 学习(4):IDEA + maven 搭建 web(2)

    参考:http://www.bubuko.com/infodetail-1855067.html 现使用 Maven 创建项目:本节接Java EE 学习(3):IDEA + maven 搭建 web ...