Maven

来源:互联网 发布:新来淘宝店铺如何推广 编辑:程序博客网 时间:2024/05/15 03:50

Maven for building Java applications - Tutorial

一、Install maven in Eclipse
Eclipse 上安装 Maven3插件

二、Create Web Project with maven in eclipse
使用m2eclipse创建web项目
eclipse集成maven3后,创建java项目详细图解
Maven web项目目录结构

这里写图片描述

在Eclipse中,使用maven创建项目,在填写 Artifact Id 时注意,Artifact Id就是指项目的名字。

三、Maven项目创建成功后,本来已经添加了 jar的依赖,但是发布到 Tomcat中就是没有jar 包存在,启动 Tomcat总是报没有找到jar包,可项目结构中确实已经有 jar了。
Elipse中发布一个Maven项目到Tomcat

1.Maven常用命令
mvn clean: 清除target目录(如果用版本控制软件(git,svn)管理项目时,将target目录清除,不要将target目录受版本控制软件管理);
mvn compile: 编译项目源代码;
mvn install:Put your artifacts in the local repository(http://maven.apache.org/plugins/maven-install-plugin/usage.html)
mvn deploy: Upload artifacts to a remote repository;
mvn package: 与 mvn install 功能相同,只是少了将 artifacts 放到本地的 repository 中的功能。

2.设置 Maven本地仓库

5.怎样将自己的项目或模块打包之后注入到本地 Repository中,以供其它项目引用
maven install
http://maven.apache.org/plugins/maven-install-plugin/

  1. How to attach source and javadoc artifacts?
    http://maven.apache.org/plugin-developers/cookbook/attach-source-javadoc-artifacts.html

  2. Get source JARs from Maven repository
    http://stackoverflow.com/questions/2059431/get-source-jars-from-maven-repository

http://stackoverflow.com/questions/310720/get-source-jar-files-attached-to-eclipse-for-maven-managed-dependencies

  1. Delete Additional Files Not Exposed to Maven
    http://stackoverflow.com/questions/2911676/delete-the-target-directory-after-build

http://maven.apache.org/plugins/maven-clean-plugin/examples/delete_additional_files.html

  1. Maven “Bill of Materials” dependencies
    http://docs.spring.io/spring/docs/current/spring-framework-reference/html/overview.html#overview-maven-bom
0 0
原创粉丝点击