--- notion-id: 78cf31c1-a49f-47d5-a7cc-81a69ea5df03 --- # vscode插件安装 安装如下两个主要扩展即可,这两个扩展已关联java项目开发主要使用的maven、springboot等所需要的扩展。 ![[IMG-20260516155648500.png]] # 下载Maven以及环境配置 [https://maven.apache.org/download.cgi](https://maven.apache.org/download.cgi) `Binary`是可执行版本,已经编译好可以直接使用。 `Source`是源代码版本,需要自己编译成可执行软件才可使用。 解压运行,配置环境变量 ```shell MAVEN_HOME E:\apache-maven-3.8.6 Path %MAVEN_HOME%\bin ``` 修改`MAVEN源镜像`以及`新建本地文件``Repository【仓库】` 具体地址`apache-maven-x.x.x\conf\settings.xml` ```json D:\maven\Repository alimaven central aliyun maven http://maven.aliyun.com/nexus/content/repositories/central/ nexus-aliyun * Nexus aliyun http://maven.aliyun.com/nexus/content/groups/public repo1 central Human Readable Name for this Mirror. http://repo1.maven.org/maven2/ repo2 central Human Readable Name for this Mirror. http://repo2.maven.org/maven2/ ``` # maven-vscode配置文件 ```json "workbench.iconTheme": "vscode-icons", "workbench.startupEditor": "newUntitledFile", "java.errors.incompleteClasspath.severity": "ignore", "workbench.colorTheme": "Atom One Dark", "java.configuration.maven.userSettings": "E:\\apache-maven-3.8.6\\conf\\settings.xml", "maven.terminal.useJavaHome": true, "maven.terminal.customEnv": [ { "environmentVariable": "JAVA_HOME", "value": "C:\\Program Files\\Java\\jdk-18.0.2" } ], ``` # MAVEN指令【启动方法:ctrl+shift+p】 ```java mvn -v //查看版本 mvn archetype:create //创建 Maven 项目 mvn compile //编译源代码 mvn test-compile //编译测试代码 mvn test //运行应用程序中的单元测试 mvn site //生成项目相关信息的网站 mvn package //依据项目生成 jar 文件 mvn install //在本地 Repository 中安装 jar mvn -Dmaven.test.skip=true //忽略测试文档编译 mvn clean //清除目标目录中的生成结果 mvn clean compile //将.java类编译为.class文件 mvn clean package //进行打包 mvn clean test //执行单元测试 mvn clean deploy //部署到版本仓库 mvn clean install //使其他项目使用这个jar,会安装到maven本地仓库中 mvn archetype:generate //创建项目架构 mvn dependency:list //查看已解析依赖 mvn dependency:tree com.xx.xxx //看到依赖树 mvn dependency:analyze //查看依赖的工具 mvn help:system //从中央仓库下载文件至本地仓库 mvn help:active-profiles //查看当前激活的profiles mvn help:all-profiles //查看所有profiles mvn help:effective -pom //查看完整的pom信息 ```