2) Delete the src file in the parent module project (optional, mainly depends on personal needs),
select the parent module of the project, right-click, select NEW -->project-->maven-->maven Module, click Next, Enter the name of the submodule in the interface that appears, click Next, and the Select an Archetype interface appears. At this time, select maven-Archetype-site-quickStart or maven-Archetype-webapp (used when building the web layer), and then select Finish to generate a subproject.
Then follow the prompts to create a Maven aggregation module
Note the <relativePath> tag, you can omit this if the pom's hierarchy is only one level apart as in this example. maven can also find child pom.
子pom中引入<parent>标签后,就会从父pom继承<version>等属性了
4、除了jar包依赖,插件也可以通过这样的方式进行管理
<!-- parent -->
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<!-- childA -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
<groupId>com.module</groupId>
<artifactId>childA</artifactId> <!--加上childA的依赖-->
<version>1.0.0</version>
</dependency>
2.错误描述:
SEVERE: Error configuring application listener of class org.springframework.web.util.Log4jConfigListener
java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
问题解析:
Maven项目中所有依赖(jdk/jar/classes)关系都被其管理。所以如果确定项目中确实存在该包或文件(org.springframework.web.util.Log4jConfigListener),那必定是项目没有添加maven依赖所致。
解决方案:
ctrl+Enter 报错项目->Deployment Assembly->Add->Java buid path entries->Next->Maven Dependencies
Clear!
此时Servers模块中的相关项目模块下多了个字节点spring-web-3.2.3.RELEASE.jar(web.xml中配置的Log4jConfigListener类所在的包)