DEV Community

Jihao Deng
Jihao Deng

Posted on • Edited on

1

Maven Basic

Maven命令

在控制台下,进入[pom.xml]所在目录

  • mvn clean
  • mvn compile
  • mvn test
  • mvn package
  • mvn install 安装项目到本地仓库

Maven目录结构

pom.xml
src
  main
    java
    resources
  test
    java
    resources
Enter fullscreen mode Exit fullscreen mode

Maven的GAV坐标

这个坐标一半写在[pom.xml]上方或者每个依赖中

<groupId>com.myrrhale.jjfresh</groupId>
<artifactId>Hello</artifactId>
<version>1.0.2</version>
Enter fullscreen mode Exit fullscreen mode
  • groupId 公司项目名
  • artifactId 项目 / 模块名
  • version 版本

依赖范围

一般有三种依赖范围:

compile test provided
main编译? Y N Y
test编译? Y Y Y
参与打包? Y N N
参与部署? Y N N
例子 spring-core junit servlet-api

Top comments (0)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay