1, 下载maven 官方网站:http://maven.apache.org
2,5分钟速成:
英文版:
http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
中文版:http://yjhexy.iteye.com/admin/blogs/443453
3,详细信息:http://maven.apache.org/guides/getting-started/index.html
4, 查找依赖:http://mvnrepository.com/
maven eclipse:eclipse的时候可以加上参数:-DdownloadSources=true
来下载包括可运行JAR包,源代码和JAVA文档。
如果是eclipse的wtp插件开发的话:mvn -Dwtpversion=2.0 eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true
有的时候发现搜索出来的内容如下图:
发现会有JDK13,和JDK15的区别,这个时候如果不指定JDK版本的话将导致引用依赖失败:
所以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.yajun</groupId>
<artifactId>jsonDemo</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>jsonDemo</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.1</version>
<scope>compile</scope>
<!-- 加上下面这个标签表示用的哪个JDK版本的 -->
<classifier>jdk15</classifier>
</dependency>
</dependencies>
</project>
5,mvn install的时候需要一起打包sources,需要添加:
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
运行:
Run "mvn -DperformRelease=true clean install"
后面如果再导入 eclipse 之前需要把eclipse生成的target 先删掉才可以。
5,最后我常用的命令:
用maven自动生成构建: mvn archetype:generate
用我指定的构建:mvn archetype:create -DgroupId=com.yajun.babyStore -DartifactId=babyStore.web -DarchetypeArtifactId=maven-archetype-webapp
打包我的应用:mvn package -DskipTests=true
6,编译的时候需要制定JDK1.5 来编译,则需要在build中加上如下plugin
<plugins>
<plugin>
<groupId>org.apache.maven
.plugins</groupId>
<artifactId>maven
-compiler-plugin</artifactId>
<version>2.0</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
mvn install:install-file -DgroupId=org.bamboo.springx -DartifactId=springx -Dversion=1.2.2 -Dpackaging=jar -Dclassifier=sources -Dfile=/path/to/file
- 大小: 201 KB
分享到:
相关推荐
maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装...
Maven3.9.4版本压缩包,仅供学习参考,更新版本请前往Maven官方下载;Maven3.9.4版本压缩包,仅供学习参考,更新版本请前往Maven官方下载;Maven3.9.4版本压缩包,仅供学习参考,更新版本请前往Maven官方下载;Maven...
官方下载maven-3.5.4,不想去网上找的可以直接下载
Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令
maven3.0maven3.0maven3.0maven3.0maven3.0maven3.0maven3.0maven3.0maven3.0maven3.0
maven3.3.9 官方下载
maven-definitive-guide_zhmaven-definitive-guide_zhmaven-definitive-guide_zhmaven-definitive-guide_zhmaven-definitive-guide_zhmaven-definitive-guide_zhmaven-definitive-guide_zhmaven-definitive-guide_...
maven 工具 maven 工具 maven 工具 maven 工具 maven 工具
Maven最新版是款项目管理和构建自动化工具。Maven包含了一个项目对象模型 (Project Object Model),一组标准集合,一个项目生命周期(Project Lifecycle),...win+R输入cmd,然后输入:mvn -version 输出安装版本就ok了
maven教程maven教程maven教程maven教程maven教程maven教程maven教程maven教程maven教程maven教程maven教程maven教程maven教程maven教程
maven
maven api
Maven常用命令 Maven Maven学习
apache-maven-3.0.5 apache-maven-3.1.1 apache-maven-3.2.5 apache-maven-3.3.9 apache-maven-3.5.4 apache-maven-3.6.3 apache-maven-3.8.5 每个版本包含4个文件: apache-maven-3.8.5-bin.tar.gz apache-maven-...
maven3.6maven3.6maven3.6
maven安装与配置 确保已安装JDK。Maven 3.9+版本需要JDK 8或更高版本。可以通过输入java -version来检查JDK是否安装以及其版本。 下载Maven。访问Maven官网下载最新版本,例如3.9.1。对于Windows用户,通常下载...
jetty 6 maven官方插件 ,在maven官网下载的
apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-...
maven教程,目录如下: Maven安装配置 Maven启用代理访问 Maven本地资源库 Maven中央存储库 如何从Maven远程存储库下载? Maven添加远程仓库 Maven依赖机制 定制库到Maven本地资源库 使用Maven创建Java项目 使用...
maven打包 maven打jar包详细步骤