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. 使用 宝塔面板快速部署Java项目

    环境描述: 服务器系统:CentOS7 64位操作系统 面板版本:宝塔6.9.4 Nginx版本:Nginx 1.16 Tomcat版本:Tomcat7 JDK版本:1.8.0_121 环境部署就不用 ...

  2. OAuth 开放授权

    什么是OAuth授权?   一.什么是OAuth协议 OAuth(开放授权)是一个开放标准. 允许第三方网站在用户授权的前提下访问在用户在服务商那里存储的各种信息. 而这种授权无需将用户提供用户名和密 ...

  3. 感谢beyond,感谢家驹

  4. iptables + Denyhost抵御暴力破解

    使用iptables 现在每分钟连接ssh的次数 #允许本地环回接口访问   1 iptables -A INPUT -i lo -j ACCEPT #对已经建立的所有链接都放行   1 iptabl ...

  5. Mysql存储过程从0开始(上)

    1.首先你要明白,mysql也是一种语言,他也可以编写程序,也是支持逻辑判断,if,elseif,else,switch,while等等的判断 2.mysql赋值一个变量的值操作:set @a = 1 ...

  6. 异常为"当IDENTITY_INSERT设置为OFF时" 解决办法

    当 IDENTITY_INSERT 设置为 OFF 时,不能向表"A" 中的标识列插入显示值. 一般来说是自增ID造成的. 因此可以在数据库insert语句前加上 SET iden ...

  7. eclipse快捷键补全

    Eclipse中 补全快捷键 默认Alt+/ 但是每个人习惯有所不同 我需要来修改自己熟悉的快捷键 windows->preferences->General->keys将Conte ...

  8. [POJ3352]Road Construction

    [POJ3352]Road Construction 试题描述 It's almost summer time, and that means that it's almost summer cons ...

  9. 查找String中出现最多字符的次数和个数

    Sting 的charAt方法返回相应位置的字符,使用该方法遍历String,将每个字符存入对象属性,遍历属性得到最多字符个数 <!DOCTYPE html> <html> & ...

  10. 创建外网 ext

    虽然外部网络是已经存在的网络,但我们还是需要在 Neutron 中定义外部网络的对象,这样 router 才知道如何将租户网络和外部网络连接起来. 上一节我们已经为创建外部网络配置了ML2,本节将通过 ...