企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 构建 ``` mvn compile ``` ```java PS D:\Java\hello-maven> mvn compile [INFO] Scanning for projects... [INFO] [INFO] --------------------------< com.hello:hello >--------------------------- [INFO] Building hello 1.0 [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- resources:3.3.1:resources (default-resources) @ hello --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\Java\hello-maven\src\main\resources [INFO] [INFO] --- compiler:3.11.0:compile (default-compile) @ hello --- [INFO] Changes detected - recompiling the module! :source [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent! [INFO] Compiling 1 source file with javac [debug target 1.8] to target\classes [WARNING] 未与 -source 8 一起设置引导类路径 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.812 s [INFO] Finished at: 2023-10-02T19:45:34+08:00 [INFO] ------------------------------------------------------------------------ ``` ![](https://img.kancloud.cn/ba/94/ba9471019d4b8b97a4514efd2ff05b69_1021x530.png) ## 清理 ![](https://img.kancloud.cn/38/50/3850107df8f3d6ec1eac59a5b24b5c9a_772x378.png) ## 测试 ![](https://img.kancloud.cn/d4/50/d45090c4abe0e5419f9bee700b4775e5_972x666.png) ## 打包 ``` mvn package ``` ![](https://img.kancloud.cn/1e/c5/1ec5a10699964447cbbafed4162a4bfb_994x597.png) 会经历**编译**(compile)-》**测试**(test)-》**打包**(package) -》**安装**(install)的过程 ![](https://img.kancloud.cn/03/a9/03a9c00b295bca16edbbfa7800fc1ce9_1102x118.png) # 通过maven插件构建项目 ### 1、构建工程(模板) ``` mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false ``` #### 2、构建java工程 ``` $ mvn archetype:generate -DgroupId=com.test2022 -DartifactId=java-project -DarchetypeArtifactId=maven-archetype-quickstart -Dversion=0.0.1-snapshot -DinteractiveMode=false ```