Maven is a powerful application building, packaging, and dependency management tool.
Almost all open source projects support distribution of libraries via the Maven repository. The most popular one is the Maven Central repository hosted on Apache, and you can access the search for the existence and related information of an artifact on the Maven Central web site.
Artifact
A group ID, artifact ID, packaging type, and version identify eahc Maven artifact.
- groupId: the unique identifier for a set of libraries available on the Maven repository. Often the library’s base package name is used as the groupId
- artifactId: the name of a specific library within the package
- version: the revision number of the library
POM是什么?
Project Object Model, the fundamental unit of work in Maven.
it is an XML file that contains information about the project and configuration details used by Maven to build the project.
Super POM
Maven’s default POM, all POMs extend the Super POM.
the configurations speficified in the Super POM is inherited by the POMs you created.
minimal POM
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
</project>
jar
Traditional Java web applications are packaged as WAR files, leaving JAR files the packaging of choice for libraries and the occasional desktop UI application.
WAR files are perfectly suitable for deploying to a traditional Java application server, but they are not a natural fit for most cloud platforms.
All Java cloud platforms are capable of running an executable JAR file, 所以可以说JAR packaging is a cloud-minded choice.
...
specify the parent POM, the parent POM provides dependency management for several libraries commonly used in Spring projects.
...
一般我们使用starter dependencies, Spring Boot starter dependencies are special in that they typically don’t have any library code thmeselves, but instead transitively pull in othe libraries. 使用Spring Boot starter dependencies大大简化了依赖管理,你需要什么功能就添加对应的starter dependency就可以了,不需要关心具体依赖哪些包以及版本号等问题。
mvn archetype:generate mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app mvn clean mvn compile the first time you execute this command, Maven will need to download all the plugins and related dependencies it needs to fulfil the command mvn dependency:tree mvn install mvn packge mvn site