WagonRun什么时候出 公测上线时间预告,
我是如何理解并使用maven的
文章转自:
http://www.cnblogs.com/longronglang/p/11069301.html
作者:Refain
前言
一直想写一篇关于Maven的文章,但是不知如何下笔,如果说能使用,会使用Maven的话,一、两个小时足矣,不需要搞懂各种概念。那么给大家来分享下我是如何理解并使用maven的。
什么是Maven?
Maven是一个用于项目构建的工具,通过它便捷的管理项目的生命周期。即项目的jar包依赖,开发,测试,发布打包,主要管理工作是:依赖管理,项目一键构建。
为什么要使用Maven
使用maven构建的项目,整个项目的体积小
maven项目不需要手动导入jar包,通过在pom.xml中添加依赖,引用依赖会自动从maven仓库下载jar包,方便快捷。
项目一键构建:使用maven可以快速地对项目进行编译--测试--运行--打包--安装
maven支持跨平台操作,可在window、linux、mac上使用
maven遵循规范开发有利于提高大型团队的开发效率,降低项目的维护成本,属于主流技术,一般公司都会使用maven来构建项目
maven仓库的配置
下载项目引用需要jar包的时候存放的本地路径
仓库的分类
本地仓库
私服(公司的仓库)
中央仓库
三个仓库之间的关系
三者之间的关系是,当我们在项目中依赖一个jar包时,Maven程序会先去本地仓库中找,如果没找到就回去私服找,如果还是没有,最后就回去中央仓库找。其过程如下图:
本地仓库的配置
找到已安装的maven路径,如:apache-maven-3.3.9\conf 目录下settings.xml 文件并用notepad++打开,ctrl+F找到localRepository标签,将路径设置为D:/repository,如下图:
说明:什么是本地仓库? 就是是由个人将常用到的jar包放入一个仓库中,已备自己在项目中使用,可从别人配置好的jar包仓库拷到自己本地目录,因为仓库一般很大,首次下载需要很长一段时间。
配置私服地址
实际工作中,很多项目都会用到maven私服仓库,一般公司都有统一的maven私服仓库,由于公司都是统一化管理,这时候我们就要配置统一的私服仓库,举例如下:
<mirrors>
<mirror>
<!--This is used to direct the public snapshots repo in the
profile below over to a different nexus group -->
<id>nexus-public-snapshots</id>
<mirrorOf>public-snapshots</mirrorOf>
<url>http://192.168.1.118:8888/nexus/content/repositories/apache-snapshots/</url>
</mirror>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
</mirrors>
pom文件说明
pom.xml文件,一般描述了maven项目的基本信息,比如groupId,artifactId,version等,一个最简单的pom.xml文件至少需要包含四个元素:modelVersion, groupId, artiffactId和version。
比如一个基本的pom.xml文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId> //当前项目的信息
<artifactId>maven-demo</artifactId>
<version>1.0-SNAPSHOT</version>//SNAPSHOT(快照)表示该项目还在开发中。
</project>
其中主要的标签含义如下:
project:pom.xml 文件中的顶层元素;
modelVersion:指明 POM 使用的对象模型的版本。这个值很少改动。
groupId:指明创建项目的组织或者小组的唯一标识。
GroupId 是项目的关键标识,典型的,此标识以组织的完全限定名来定义。比如,org.apache.maven.plugins 是所有 Maven 插件项目指定的 groupId。
artifactId:指明此项目产生的主要产品的基本名称。项目的主要产品通常为一个 JAR 文件。第二,象源代码包通常使用 artifactId 作为最后名称的一部分。典型的产品名称使用这个格式:
version:项目产品的版本号。Maven 帮助你管理版本,可以经常看到 SNAPSHOT 这个版本,表明项目处于开发阶段。
在项目中添加插件,以及对插件的配置
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>//编译插件
<version>2.4.3</version>//插件的版本号
<configuration>//对插件进行配置
<source>1.7</source>//源代码编译版本
<target>1.7</target>//目标平台编译版本;
<encoding>UTF-8</encoding>//设置插件或资源文件的编码方式。
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>//执行测试用例的插件
<version>2.17</version>//插件的版本号
<configuration>//对插件进行配置
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>//测试套件执行路径
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
如何在pom文件中添加依赖jar包
实际开发中需要引用jar包后,再进行开发,那么在pom中添加依赖呢?
1、比如我想添加testng.jar包,那么可以通过访问网址 https://mvnrepository.com/ ,然后在搜索框中输入testng,回车
2、点击testng,选择对应版本如6.14.3
3、复制红框中内容,放到dependencies标签内。
在pom中引用完成,并自动下载依赖jar包。
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
</dependencies>
实际效果:
编写一个测试类
package com.test.demo;
import org.testng.Assert;
import org.testng.annotations.Test;
public class HellowWorld {
@Test
public void test {
Assert.assertEquals("HellowWorld","HellowWorld");
}
}
maven项目的目录结构
F:\mavendemo>tree
卷 新加卷 的文件夹 PATH 列表
卷序列号为 5C5B-6DDB
F:.
├─.idea
└─ src
├─ main
│ ├─ java
│ │ └─com
│ │ └─test
│ │ └─demo
│ └─resources
└─ test
└─java
└─com
└─test
└─demo
注意上面带红色的目录名,maven项目采用“ 约定优于配置” 的原则, src/main/java 约定用于存放源代码, src/main/test 用于存放单元测试代码, src/target 用于存放编译、打包后的输出文件。这是全世界maven项目的通用约定,请记住这些固定的目录结构。
编译和测试
在项目根目录下运行 mvn clean compile
命令。执行输出如下所示:
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8Scanning for projects... ------------------------------------------------------------------------ Building maven-demo 1.0-SNAPSHOT ------------------------------------------------------------------------ --- maven-clean-plugin:2.5:clean (default-clean) @ maven-demo --- Deleting F:\mavendemo\target --- maven-resources-plugin:2.6:resources (default-resources) @ maven-demo --- Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! Copying 0 resource --- maven-compiler-plugin:2.5.1:compile (default-compile) @ maven-demo --- File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! Compiling 1 source file to F:\mavendemo\target\classes ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 1.336 s Finished at: 2019-06-23T17:33:29+08:00 Final Memory: 13M/309M ------------------------------------------------------------------------
clean:
清理输出目录target下生成jar包
compile:
编译项目主代码
编译完成后,我们一般都会运行测试代码进行单元测试,虽然很多情况下,我们并没有这么做,但是我还是建议大家通过Maven做一些自动化的单元测试。
测试用例编写完毕之后就可以调用Maven执行测试,运行 mvn clean test
命令,输出如下:
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8Scanning for projects... ------------------------------------------------------------------------ Building maven-demo 1.0-SNAPSHOT ------------------------------------------------------------------------ --- maven-clean-plugin:2.5:clean (default-clean) @ maven-demo --- Deleting F:\mavendemo\target --- maven-resources-plugin:2.6:resources (default-resources) @ maven-demo --- Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! Copying 0 resource --- maven-compiler-plugin:2.5.1:compile (default-compile) @ maven-demo --- File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! Compiling 1 source file to F:\mavendemo\target\classes --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-demo --- Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! skip non existing resourceDirectory F:\mavendemo\src\test\resources --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ maven-demo --- File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! Compiling 1 source file to F:\mavendemo\target\test-classes --- maven-surefire-plugin:2.17:test (default-test) @ maven-demo --- ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 2.032 s Finished at: 2019-06-23T17:27:28+08:00 Final Memory: 15M/309M ------------------------------------------------------------------------
打包和运行
打包就是将我们编写的应用打成JAR包或者WAR包,我们执行 mvn clean package
命令就可以完成打包。mvn clean package
命令的输出如下:
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8Scanning for projects... ------------------------------------------------------------------------ Building maven-demo 1.0-SNAPSHOT ------------------------------------------------------------------------ --- maven-clean-plugin:2.5:clean (default-clean) @ maven-demo --- Deleting F:\mavendemo\target --- maven-resources-plugin:2.6:resources (default-resources) @ maven-demo --- Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! Copying 0 resource --- maven-compiler-plugin:2.5.1:compile (default-compile) @ maven-demo --- File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! Compiling 1 source file to F:\mavendemo\target\classes --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-demo --- Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! skip non existing resourceDirectory F:\mavendemo\src\test\resources --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ maven-demo --- File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! Compiling 1 source file to F:\mavendemo\target\test-classes --- maven-surefire-plugin:2.17:test (default-test) @ maven-demo --- Surefire report directory: F:\mavendemo\test-output
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.test.demo.TestHellowWorld
Configuring TestNG with: TestNG652Configurator
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.498 sec - in com.test.demo.TestHellowWorld
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0--- maven-jar-plugin:2.4:jar (default-jar) @ maven-demo --- Building jar: F:\mavendemo\target\maven-demo-1.0-SNAPSHOT.jar ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 3.356 s Finished at: 2019-06-23T17:46:00+08:00 Final Memory: 17M/311M ------------------------------------------------------------------------
运行完后,会在target目录下生成jar包
如果别的项目要引用这个JAR包时,我们将这个JAR包复制到其它项目的classpath中就OK了。
但是这样拷贝就违背了我们当初想要自动解决依赖的问题,所以如何才能让其它的Maven项目直接引用这个JAR包呢?我们需要执行 mvn clean install
命令。
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8Scanning for projects... ------------------------------------------------------------------------ Building maven-demo 1.0-SNAPSHOT ------------------------------------------------------------------------ --- maven-clean-plugin:2.5:clean (default-clean) @ maven-demo --- Deleting F:\mavendemo\target --- maven-resources-plugin:2.6:resources (default-resources) @ maven-demo --- Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! Copying 0 resource --- maven-compiler-plugin:2.5.1:compile (default-compile) @ maven-demo --- File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! Compiling 1 source file to F:\mavendemo\target\classes --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-demo --- Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! skip non existing resourceDirectory F:\mavendemo\src\test\resources --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ maven-demo --- File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! Compiling 1 source file to F:\mavendemo\target\test-classes --- maven-surefire-plugin:2.17:test (default-test) @ maven-demo --- Surefire report directory: F:\mavendemo\test-output
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.test.demo.TestHellowWorld
Configuring TestNG with: TestNG652Configurator
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.611 sec - in com.test.demo.TestHellowWorld
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0--- maven-jar-plugin:2.4:jar (default-jar) @ maven-demo --- Building jar: F:\mavendemo\target\maven-demo-1.0-SNAPSHOT.jar --- maven-install-plugin:2.4:install (default-install) @ maven-demo --- Installing F:\mavendemo\target\maven-demo-1.0-SNAPSHOT.jar to E:\repository\com\test\maven-demo\1.0-SNAPSHOT\maven-demo-1.0-SNAPSHOT.jar Installing F:\mavendemo\pom.xml to E:\repository\com\test\maven-demo\1.0-SNAPSHOT\maven-demo-1.0-SNAPSHOT.pom ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 4.643 s Finished at: 2019-06-23T20:39:34+08:00 Final Memory: 16M/211M ------------------------------------------------------------------------
使用Archetype生成项目骨架
下面通过用命名行创建一个最基本的maven项目
mvn archetype:generate
先创建项目的根目录,从盘符开始,命令行窗口下输入
mkdir demotest
cd demotest
mvn archetype:generate
首次运行时,mvn会从远程"中央仓库"下载一些必需的文件到"本地仓库" -
如果你有兴趣,可以在等待下载过程中,观察一下"C:\Users\当前用户名\.m2\repository"目录下是不是多了很多文件。
下载完成后,会自动进入交互模式,会让你输入一些基本信息,类似下面这样:
F:\demotest>mvn archetype:generate
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8Scanning for projects... ------------------------------------------------------------------------ Building Maven Stub Project (No POM) 1 ------------------------------------------------------------------------ >>> maven-archetype-plugin:3.0.0:generate (default-cli) > generate-sources @ standalone-pom >>> <<< maven-archetype-plugin:3.0.0:generate (default-cli) < generate-sources @ standalone-pom <<< --- maven-archetype-plugin:3.0.0:generate (default-cli) @ standalone-pom ---
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-artifact-transfer/0.9.0/maven-artifact-transfer-0.9.0.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-artifact-transfer/0.9.0/maven-artifact-transfer-0.9.0.pom (8 KB at 5.4 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-common-artifact-filters/3.0.0/maven-common-artifact-filters-3.0.0.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-common-artifact-filters/3.0.0/maven-common-artifact-filters-3.0.0.pom (5 KB at 10.1 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-components/22/maven-shared-components-22.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-components/22/maven-shared-components-22.pom (5 KB at 11.2 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-provider-api/2.8/wagon-provider-api-2.8.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-provider-api/2.8/wagon-provider-api-2.8.pom (2 KB at 3.8 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon/2.8/wagon-2.8.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon/2.8/wagon-2.8.pom (19 KB at 41.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.pom (32 KB at 26.9 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/antlr/antlr/2.7.7/antlr-2.7.7.pom
Downloaded: https://repo.maven.apache.org/maven2/antlr/antlr/2.7.7/antlr-2.7.7.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/asm/asm/3.2/asm-3.2.pom
Downloaded: https://repo.maven.apache.org/maven2/asm/asm/3.2/asm-3.2.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/asm/asm-parent/3.2/asm-parent-3.2.pom
Downloaded: https://repo.maven.apache.org/maven2/asm/asm-parent/3.2/asm-parent-3.2.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/asm/asm-commons/3.2/asm-commons-3.2.pom
Downloaded: https://repo.maven.apache.org/maven2/asm/asm-commons/3.2/asm-commons-3.2.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/asm/asm-tree/3.2/asm-tree-3.2.pom
Downloaded: https://repo.maven.apache.org/maven2/asm/asm-tree/3.2/asm-tree-3.2.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/asm/asm-util/3.2/asm-util-3.2.pom
Downloaded: https://repo.maven.apache.org/maven2/asm/asm-util/3.2/asm-util-3.2.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/asm/asm-analysis/3.2/asm-analysis-3.2.pom
Downloaded: https://repo.maven.apache.org/maven2/asm/asm-analysis/3.2/asm-analysis-3.2.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-6/plexus-interactivity-api-1.0-alpha-6.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-6/plexus-interactivity-api-1.0-alpha-6.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity/1.0-alpha-6/plexus-interactivity-1.0-alpha-6.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity/1.0-alpha-6/plexus-interactivity-1.0-alpha-6.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.9/plexus-components-1.1.9.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.9/plexus-components-1.1.9.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-script-interpreter/1.0/maven-script-interpreter-1.0.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-script-interpreter/1.0/maven-script-interpreter-1.0.pom (4 KB at 8.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.8.1/ant-1.8.1.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.8.1/ant-1.8.1.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/ant/ant-parent/1.8.1/ant-parent-1.8.1.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/ant/ant-parent/1.8.1/ant-parent-1.8.1.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-catalog/3.0.0/archetype-catalog-3.0.0.jar
Downloading: https://repo.maven.apache.org/maven2/net/sourceforge/jchardet/jchardet/1.0/jchardet-1.0.jar
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-common/3.0.0/archetype-common-3.0.0.jar
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-descriptor/3.0.0/archetype-descriptor-3.0.0.jar
Downloading: https://repo.maven.apache.org/maven2/jdom/jdom/1.0/jdom-1.0.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-catalog/3.0.0/archetype-catalog-3.0.0.jar (19 KB at 39.7 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar
Downloaded: https://repo.maven.apache.org/maven2/jdom/jdom/1.0/jdom-1.0.jar (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/antlr/antlr/2.7.7/antlr-2.7.7.jar
Downloaded: https://repo.maven.apache.org/maven2/antlr/antlr/2.7.7/antlr-2.7.7.jar (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/asm/asm/3.2/asm-3.2.jar
Downloaded: https://repo.maven.apache.org/maven2/net/sourceforge/jchardet/jchardet/1.0/jchardet-1.0.jar (26 KB at 26.5 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/asm/asm-commons/3.2/asm-commons-3.2.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-descriptor/3.0.0/archetype-descriptor-3.0.0.jar (24 KB at 20.6 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/asm/asm-util/3.2/asm-util-3.2.jar
Downloaded: https://repo.maven.apache.org/maven2/asm/asm-util/3.2/asm-util-3.2.jar (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/asm/asm-analysis/3.2/asm-analysis-3.2.jar
Downloaded: https://repo.maven.apache.org/maven2/asm/asm-analysis/3.2/asm-analysis-3.2.jar (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/asm/asm-tree/3.2/asm-tree-3.2.jar
Downloaded: https://repo.maven.apache.org/maven2/asm/asm-commons/3.2/asm-commons-3.2.jar (33 KB at 20.2 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.21/plexus-utils-3.0.21.jar
Downloaded: https://repo.maven.apache.org/maven2/asm/asm-tree/3.2/asm-tree-3.2.jar (22 KB at 10.6 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-6/plexus-interactivity-api-1.0-alpha-6.jar
Downloaded: https://repo.maven.apache.org/maven2/asm/asm/3.2/asm-3.2.jar (43 KB at 19.6 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-invoker/2.2/maven-invoker-2.2.jar
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-6/plexus-interactivity-api-1.0-alpha-6.jar (12 KB at 4.7 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-artifact-transfer/0.9.0/maven-artifact-transfer-0.9.0.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-invoker/2.2/maven-invoker-2.2.jar (30 KB at 8.3 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-common-artifact-filters/3.0.0/maven-common-artifact-filters-3.0.0.jar
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.21/plexus-utils-3.0.21.jar (240 KB at 56.1 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-script-interpreter/1.0/maven-script-interpreter-1.0.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-artifact-transfer/0.9.0/maven-artifact-transfer-0.9.0.jar (121 KB at 27.4 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.8.1/ant-1.8.1.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.8.1/ant-1.8.1.jar (0 B at 0.0 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-script-interpreter/1.0/maven-script-interpreter-1.0.jar (21 KB at 4.0 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-common-artifact-filters/3.0.0/maven-common-artifact-filters-3.0.0.jar (56 KB at 10.6 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-common/3.0.0/archetype-common-3.0.0.jar (324 KB at 51.1 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar (5394 KB at 19.0 KB/sec)Generating project in Interactive mode
.............................................................................
执行这个命令后,后看到很多输出,然后再按照提示一步步操作,一个Maven项目就创建成功了。
总结
到此,关于maven的入门基础知识总结完毕,文章知识点相对繁琐、复杂,还请读者多次阅读和实践,如有错误之处,烦请多指正!
-
WagonRun什么时候出 公测上线时间预告, 2023-10-05
-
V社确认《最终幻想14》即将重新适配Steam Deck, 2023-10-05
-
v天界修真诀好玩吗 v天界修真诀玩法简介, 2023-10-05
-
vz55配件和技能,vz55配件 2023-10-05
-
VR集成化技术工程师:“虚似”与“实际”的铁路桥人,vr技术应用工程师 2023-10-05
-
vr游戏有哪些好玩的手机游戏 2022手机上的vr游戏推荐, 2023-10-05
-
vr游戏大全下载排行榜2021 十大热门好玩的vr手游合集推荐,ps4好玩的vr游戏 2023-10-05
-
vr枪战游戏手机下载前五名2022 vr枪战游戏有哪些, 2023-10-05
-
vr有什么好玩的游戏推荐2022 爆火的vr游戏有哪些, 2023-10-05
-
VR怎样颠覆式创新我国高等职业教育?高官专家学者齐“号脉”(图), 2023-10-05