• maven的聚合与继承



    新建一个空的maven项目user-parent
    Pom.xml内容
    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. <groupId>tz.itat.user</groupId>
    5. <artifactId>user-code</artifactId>
    6. <version>0.0.1-SNAPSHOT</version>
    7. <packaging>pom</packaging>
    8. <url>http://maven.apache.org</url>
    9. <!-- 导入了三个模块,把这三个模块聚合在一起了 -->
    10. <modules>
    11. <!-- 聚合是模块的位置 -->
    12. <module>user-core</module>
    13. <module>user-log</module>
    14. <module>user-service</module>
    15. </modules>
    16. <!-- 定义常量 -->
    17. <properties>
    18. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    19. <spring.vaesion>3.1.1</spring.vaesion>
    20. </properties>
    21. <!-- 依赖管理的类,子类不会自动去依赖继承他 -->
    22. <dependencyManagement>
    23. <dependencies>
    24. <dependency>
    25. <groupId>org.hibernate</groupId>
    26. <artifactId>hibernate-entitymanager</artifactId>
    27. <version>4.1.0.Final</version>
    28. </dependency>
    29. <dependency>
    30. <groupId>mysql</groupId>
    31. <artifactId>mysql-connector-java</artifactId>
    32. <version>5.1.24</version>
    33. </dependency>
    34. <dependency>
    35. <groupId>log4j</groupId>
    36. <artifactId>log4j</artifactId>
    37. <version>1.2.17</version>
    38. </dependency>
    39. <dependency>
    40. <groupId>commons-logging</groupId>
    41. <artifactId>commons-logging</artifactId>
    42. <version>1.1.1</version>
    43. </dependency>
    44. </dependencies>
    45. </dependencyManagement>
    46. </project>


    继承父类
    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. <parent>
    5. <groupId>tz.itat.user</groupId>
    6. <artifactId>user-parent</artifactId>
    7. <version>0.0.1-SNAPSHOT</version>
    8. <relativePath>../user-parent/pom.xml</relativePath>
    9. </parent>
    10. <artifactId>user-code</artifactId>
    11. <packaging>jar</packaging>
    12. <name>user-code</name>
    13. <dependencies>
    14. <!--版本就是引用父类的-->
    15. <dependency>
    16. <groupId>org.hibernate</groupId>
    17. <artifactId>hibernate-entitymanager</artifactId>
    18. </dependency>
    19. <dependency>
    20. <groupId>mysql</groupId>
    21. <artifactId>mysql-connector-java</artifactId>
    22. </dependency>
    23. <dependency>
    24. <groupId>log4j</groupId>
    25. <artifactId>log4j</artifactId>
    26. </dependency>
    27. </dependencies>
    28. </project>





  • 相关阅读:
    query.setXXX预编译赋值 (坑爹的)
    JAVA 预编译执行SQL 之setparameterList用法
    ActiveMQ
    JavaScript DOM日记
    Mysql 详解(三)
    Mysq连接使用
    Mysql详解(二)
    Mysql详解(一)
    Spring MVC 批量导入Excel文件
    《走遍中国》珍藏版(三)
  • 原文地址:https://www.cnblogs.com/plf112233/p/4503798.html
Copyright © 2020-2023  润新知