pom.xml 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3. <modelVersion>4.0.0</modelVersion>
  4. <!-- 在maven管理jar包时 是通过 groupId artifactId version-->
  5. <!-- 在创建一个maven项目时 也需要定义三要素 是因为当前项目也可以打包成jar 提供给别的项目使用-->
  6. <groupId>com.sf</groupId>
  7. <artifactId>maven-demo</artifactId>
  8. <version>1.0-SNAPSHOT</version>
  9. <!-- 打包方式 -->
  10. <packaging>pom</packaging>
  11. <!-- 对应到maven栏中的名字 -->
  12. <name>maven-demo</name>
  13. <!-- maven官方路径 apache是一个软件基金会 a patchy server 补丁服务-->
  14. <!-- maven 是自动化构建工具-->
  15. <!-- 构建: 是将工程编译得到的结果部署到服务器上的过程 -->
  16. <url>http://maven.apache.org</url>
  17. <!-- 在添加模块后 会在父项目的url下 增加模块列表 -->
  18. <modules>
  19. <!-- 具体模块名 -->
  20. <module>sub-demo</module>
  21. <module>sub1-demo</module>
  22. </modules>
  23. <!-- 配置 帮我们统一管理版本号 -->
  24. <properties>
  25. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  26. <spring.version>6.1.12</spring.version>
  27. </properties>
  28. <!--dependencies 意思是依赖列表 -->
  29. <!--dependencyManagement 可以让父项目的依赖 不会被子项目自动引入 -->
  30. <!-- 同时在子项目明确引入依赖时 可以复用这里的版本 -->
  31. <dependencyManagement>
  32. <dependencies>
  33. <dependency>
  34. <!-- 查看引入依赖的地址 以配置的maven仓库为起始地址 + groupId + artifactId + version + jar包名(artifactId + version) -->
  35. <!-- /Users/Qing/.m2/repository/com/google/code/gson/gson/2.11.0/gson-2.11.0.jar -->
  36. <groupId>com.google.code.gson</groupId>
  37. <artifactId>gson</artifactId>
  38. <version>2.11.0</version>
  39. </dependency>
  40. <!-- 这里是可以存放多个依赖的 -->
  41. <dependency>
  42. <groupId>org.junit.jupiter</groupId>
  43. <artifactId>junit-jupiter</artifactId>
  44. <version>5.11.0</version>
  45. </dependency>
  46. <dependency>
  47. <groupId>org.springframework</groupId>
  48. <artifactId>spring-context</artifactId>
  49. <!-- 使用$+大括号来指代变量 通过变量名找到变量值 -->
  50. <version>${spring.version}</version>
  51. </dependency>
  52. <dependency>
  53. <groupId>org.springframework</groupId>
  54. <artifactId>spring-aop</artifactId>
  55. <version>${spring.version}</version>
  56. </dependency>
  57. </dependencies>
  58. </dependencyManagement>
  59. <!-- 对编译进行配置 -->
  60. <build>
  61. <!-- 插件列表 -->
  62. <plugins>
  63. <!-- 单个插件的配置 -->
  64. <plugin>
  65. <!-- 也是通过三要素找到插件 -->
  66. <groupId>org.apache.maven.plugins</groupId>
  67. <artifactId>maven-compiler-plugin</artifactId>
  68. <version>3.11.0</version>
  69. <!-- 对插件的使用进行配置 -->
  70. <configuration>
  71. <source>17</source>
  72. <target>17</target>
  73. </configuration>
  74. </plugin>
  75. </plugins>
  76. </build>
  77. </project>