In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Maven in how to use aggregation module, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
1. What is the aggregation module of maven?
The aggregation module is the top level of the project directory, and other modules exist as aggregation module subdirectories. The goal is to build multiple project modules at a time.
1.1 Project structure
I made a relationship about the project myself:
1.2 pom tag configuration-module
As a maven pom project, maven-aggregate needs to define the packaging of pom.xml as the pom type.
With reference to the dependency features of maven, conflict resolution (5) create a maven-01 maven-02 maven-03 project, and aggregate the three maven projects through the maven-aggregate pom project, configured as follows:
Xml code
1. 3. 4.0.0 5. Com.sohu.train 6. Maven-aggregate 7. 0.0.1-SNAPSHOT 8. Pom 10. 11. 12... / maven-01 13... / maven-02 14... maven-03 15. 17.
Execute mvn clean compile on maven-aggregate
Xml code
1.\ [INFO\] Scanning for projects... 2.\ [WARNING\] 3.\ [WARNING\] Some problems were encountered while building the effective model for com.sohu.train:maven-02:jar:1.0-SNAPSHORT 4.\ [WARNING\] 'dependencies.dependency.exclusions.exclusion.groupId' for junit:junit:jar is missing. @ line 38 Column 16 5.\ [WARNING\] 'dependencies.dependency.exclusions.exclusion.artifactId' for junit:junit:jar is missing. @ line 38, column 16 6.\ [WARNING\] 7.\ [WARNING\] It is highly recommended to fix these problems because they threaten the stability of your build. 8.\ [WARNING\] 9.\ [WARNING\] For this reason Future Maven versions might no longer support building such malformed projects. 10.\ [WARNING\] 11.\ [INFO\]-12.\ [INFO\] Reactor Build Order: / / build maven's reactor The order in which clean compilation is performed is 13.\ [INFO\] 14.\ [INFO\] maven-02 15.\ [INFO\] maven-01 16.\ [INFO\] maven-03 17.\ [INFO\] maven-aggregate 18.\ [INFO\] 19.\ [INFO\]- 20.\ [INFO\] Building maven-02 1.0-SNAPSHORT 21. [INFO\]-22. \ [INFO\] 23. \ [INFO\]-maven-clean-plugin:2.5:clean (default-clean) @ maven-02-24. \ [INFO\] Deleting E:\ train\\ test\\ maven-02\\ target 25. \ [INFO\] 26. \ [INFO\]-maven-resources-plugin:2.6:resources (default-resources) @ maven-02-27. [INFO\] Using 'UTF-8' encoding to copy filtered resources. 28. \ [INFO\] skip non existing resourceDirectory E:\ train\\ test\\ maven-02\\ src\\ main\\ resources 29. \ [INFO\] 30. \ [INFO\]-maven-compiler-plugin:3.1:compile (default-compile) @ maven-02-31. [INFO\] Changes detected-recompiling the module! 32. [INFO\] Compiling 1 source file to E:\\ train\\ test\\ maven-02\\ target\\ classes 33. \ [INFO\] 34. [INFO\]-35. \ [INFO\] Building maven-01 1.0-SNAPSHOT 36. \ [INFO\]-37. \ [INFO\] 38. \ [INFO\]-maven-clean-plugin:2.5:clean (default-clean) @ maven-01-39. \ [INFO\] Deleting E:\ train\\ test\\ maven-01\\ target 40. \ [INFO\] 41. \ [INFO\]-maven-resources-plugin:2.6:resources (default-resources) @ maven-01-42. [INFO\] Using 'UTF-8' encoding to copy filtered resources. 43. [INFO\] Copying 1 resource 44. \ [INFO\] 45. \ [INFO\]-maven-compiler-plugin:3.1:compile (default-compile) @ maven-01-46. [INFO\] Changes detected-recompiling the module! 47. \ [INFO\] Compiling 1 source file to E:\ train\\ test\\ maven-01\\ target\\ classes 48. \ [INFO\] 49. [INFO\]-50. \ [INFO\] Building maven-03 0.0.1-SNAPSHOT 51. [INFO\]-52. \ [INFO\] 53. \ [INFO\]-maven-clean-plugin:2.5:clean (default-clean) @ maven-03-54. \ [INFO\] Deleting E:\ train\\ test\\ maven-03\\ target 55. \ [INFO\] 56. \ [INFO\]-maven-resources-plugin:2.6:resources (default-resources) @ maven-03-57. \ [INFO\] Using 'UTF-8' encoding to copy filtered resources. 58. [INFO\] skip non existing resourceDirectory E:\\ train\\ test\\ maven-03\\ src\\ main\\ resources 59. \ [INFO\] 60. \ [INFO\]-maven-compiler-plugin:3.1:compile (default-compile) @ maven-03-61. [INFO\] Changes detected-recompiling the module! 62. [INFO\] Compiling 1 source file to E:\\ train\\ test\\ maven-03\\ target\\ classes 63. \ [INFO\] 64. [INFO\]-65. \ [INFO\] Building maven-aggregate 0.0.1-SNAPSHOT 66. [INFO\]-67. \ [INFO\] 68. \ [INFO\]-maven-clean-plugin:2.5:clean (default-clean) @ maven-aggregate-69. [INFO\]-70. \ [INFO\] Reactor Summary: / / you can see compiling 71 for 3 maven projects together. \ [INFO\] 72. \ [INFO\] maven-02... SUCCESS\ [1.874 s\] 73. \ [INFO\] maven-01... SUCCESS\ [0.108 s\] 74. \ [INFO\] maven-03... SUCCESS\ [0.158 s\] 75. \ [INFO\] maven-aggregate.. SUCCESS\ [0.002 s\] 76. \ [INFO\]-77. \ [INFO\] BUILD SUCCESS 78. \ [INFO\]-79. \ [INFO\] Total time: 2.263 s 80. [INFO\] Finished at: 2016-01-15T14:35:41+08:00 81. [INFO\] Final Memory: 14M/227M 82. [INFO\]
In this way, we complete the aggregation of sub-modules in maven, such as dubbo jetty tomcat spring hibernate, which we usually use, etc. are developed by module, and each module can be closely linked at one time. We also need appropriate sub-module development in ordinary development projects.
This is a sub-module of dubbo, divided into many sub-modules:
two。 What is pom inheritance?
Pom inheritance is designed to extract duplicate configurations, usually configured in the parent module to provide use for the child module, so that it can be "declared everywhere, used everywhere".
2.1 inheritance structure
2.2 pom tag configuration-parent,*Management
1. Commonly used pom inherited elements
Xml code
1. GroupId: project team ID, core element of project coordinates; 2. Version: project version, core element of project coordinates; 3. Description: project description information; 4. Properties: custom Maven attribute; 5. Dependencies: project dependency configuration; 6. DependencyManagement: eye-catching dependency management configuration 7. Repositories: project warehouse configuration; 8. Build: including project source directory configuration, output directory configuration, plug-in configuration, plug-in management configuration, etc.
1. Configure the maven-aggregate pom file:
Xml code
1. 3. 4.0.0 5. Com.sohu.train 6. Maven-aggregate 7. 0.0.1-SNAPSHOT 8. Pom 10. 11. 12... / maven-01 13... / maven-02 14... / maven-03 15. 16. 17. 18. 3.8.1 19. 21. twenty-two。 23. 24. 25. Junit 26. Junit 27. ${junit.version} 28. Test 29. thirty。 thirty-one。 thirty-two。
Maven-01,maven-02,maven-03 needs to configure parent and dependencies, and make a dependency on junit at the same time. The pom configurations of the three projects are as follows:
Xml code
1. 3. 4.0.0 4. 5. 6. Com.sohu.train 7. Maven-aggregate 8. 0.0.1-SNAPSHOT 9... / maven-aggregate/pom.xml 10. 11. Maven-03 12. Jar 13. 14. 15. 16. Junit 17. Junit 18. 19. 20.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.