In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
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 download
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 download
4.0.0
Com.sohu.train
Maven-aggregate
0.0.1-SNAPSHOT
Pom
.. / maven-01
.. / maven-02
.. maven-03
Execute mvn clean compile on maven-aggregate
Xml code download
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.sohu.train:maven-02:jar:1.0-SNAPSHORT
[WARNING] 'dependencies.dependency.exclusions.exclusion.groupId' for junit:junit:jar is missing. @ line 38, column 16
[WARNING] 'dependencies.dependency.exclusions.exclusion.artifactId' for junit:junit:jar is missing. @ line 38, column 16
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] Reactor Build Order: / / build the reactor of maven and perform the order of clean compilation
[INFO]
[INFO] maven-02
[INFO] maven-01
[INFO] maven-03
[INFO] maven-aggregate
[INFO]
[INFO]
[INFO] Building maven-02 1.0-SNAPSHORT
[INFO]
[INFO]
[INFO]-maven-clean-plugin:2.5:clean (default-clean) @ maven-02-
[INFO] Deleting E:\ train\ test\ maven-02\ target
[INFO]
[INFO]-maven-resources-plugin:2.6:resources (default-resources) @ maven-02-
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\ train\ test\ maven-02\ src\ main\ resources
[INFO]
[INFO]-maven-compiler-plugin:3.1:compile (default-compile) @ maven-02-
[INFO] Changes detected-recompiling the module!
[INFO] Compiling 1 source file to E:\ train\ test\ maven-02\ target\ classes
[INFO]
[INFO]
[INFO] Building maven-01 1.0-SNAPSHOT
[INFO]
[INFO]
[INFO]-maven-clean-plugin:2.5:clean (default-clean) @ maven-01-
[INFO] Deleting E:\ train\ test\ maven-01\ target
[INFO]
[INFO]-maven-resources-plugin:2.6:resources (default-resources) @ maven-01-
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO]-maven-compiler-plugin:3.1:compile (default-compile) @ maven-01-
[INFO] Changes detected-recompiling the module!
[INFO] Compiling 1 source file to E:\ train\ test\ maven-01\ target\ classes
[INFO]
[INFO]
[INFO] Building maven-03 0.0.1-SNAPSHOT
[INFO]
[INFO]
[INFO]-maven-clean-plugin:2.5:clean (default-clean) @ maven-03-
[INFO] Deleting E:\ train\ test\ maven-03\ target
[INFO]
[INFO]-maven-resources-plugin:2.6:resources (default-resources) @ maven-03-
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\ train\ test\ maven-03\ src\ main\ resources
[INFO]
[INFO]-maven-compiler-plugin:3.1:compile (default-compile) @ maven-03-
[INFO] Changes detected-recompiling the module!
[INFO] Compiling 1 source file to E:\ train\ test\ maven-03\ target\ classes
[INFO]
[INFO]
[INFO] Building maven-aggregate 0.0.1-SNAPSHOT
[INFO]
[INFO]
[INFO]-maven-clean-plugin:2.5:clean (default-clean) @ maven-aggregate-
[INFO]
[INFO] Reactor Summary: / / you can see compiling 3 maven projects together
[INFO]
[INFO] maven-02... SUCCESS [1.874 s]
[INFO] maven-01... SUCCESS [0.108 s]
[INFO] maven-03... SUCCESS [0.158 s]
[INFO] maven-aggregate.. SUCCESS [0.002 s]
[INFO]
[INFO] BUILD SUCCESS
[INFO]
[INFO] Total time: 2.263 s
[INFO] Finished at: 2016-01-15T14:35:41+08:00
[INFO] Final Memory: 14M/227M
[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: download
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
download
2.2 pom tag configuration-parent,*Management
1. Commonly used pom inherited elements
Xml code download
GroupId: project team ID, the core element of project coordinates
Version: project version, the core element of project coordinates
Description: description of the project
Properties: custom Maven attribute
Dependencies: dependent configuration of the project
DependencyManagement: eye-catching dependency management configuration
Repositories: warehouse configuration for the project
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 download
4.0.0
Com.sohu.train
Maven-aggregate
0.0.1-SNAPSHOT
Pom
.. / maven-01
.. / maven-02
.. / maven-03
3.8.1
Junit
Junit
${junit.version}
Test
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 download
4.0.0
Com.sohu.train
Maven-aggregate
0.0.1-SNAPSHOT
.. / maven-aggregate/pom.xml
Maven-03
Jar
Junit
Junit
In this way, the inheritance of pom is completed, and multiple references can be implemented by configuring the common jar at once.
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.