Java maven反应堆构建学习实践

Java maven反应堆构建学习实践

实践环境

Apache Maven 3.0.5 (Red Hat 3.0.5-17)

应用示例

示例项目结构

maven示例项目组织结构如下

maven-study │  pom.xml │ ├─first-sub-module │  │  pom.xml │  │ │  ├─src │  │  ├─main │  │  │  └─java │  │  │      └─com │  │  │          └─shouke │  │  │              └─mvnstudy │  │  │                      HelloMaven.java │  │  │ │  │  └─test │  │      └─java │  │          └─com │  │              └─shouke │  │                  └─mvnstudy │  │                          TestHelloMaven.java │  │ │  └─sub-sub-module │      │  pom.xml │      │ │      └─src │          ├─main │          │  └─java │          │      └─com │          │          └─shouke │          │              └─mvnstudy │          │                      HelloMaven.java │          │ │          └─test │              └─java │                  └─com │                      └─shouke │                          └─mvnstudy │                                  TestHelloMaven.java │ └─second-sub-module     │  pom.xml     │     └─src         ├─main         │  └─java         │      └─com         │          └─shouke         │              └─mvnstudy         │                      HelloMaven.java         │         └─test             └─java                 └─com                     └─shouke                         └─mvnstudy                                 TestHelloMaven.java 

pom.xml

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelVersion>4.0.0</modelVersion>      <groupId>com.shouke.mvnstudy</groupId>     <artifactId>parent-module</artifactId>     <version>1.0.0-SNAPSHOT</version>     <packaging>pom</packaging>      <dependencies>         <!-- junit 依赖 -->         <dependency>             <groupId>junit</groupId>             <artifactId>junit</artifactId>             <version>4.10</version>             <scope>test</scope>         </dependency>     </dependencies>          <modules>             <module>first-sub-module</module>         <module>second-sub-module</module>     </modules> </project> </xml> 

first-sub-module/pom.xml

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelVersion>4.0.0</modelVersion>          <groupId>com.shouke.mvnstudy</groupId>     <artifactId>first-sub-module</artifactId>     <version>1.0.0-SNAPSHOT</version>      <dependencies>         <!-- junit 依赖 -->         <dependency>             <groupId>junit</groupId>             <artifactId>junit</artifactId>             <version>4.10</version>             <scope>test</scope>         </dependency>         <dependency>             <groupId>com.shouke.mvnstudy</groupId>             <artifactId>second-sub-module</artifactId>             <version>1.0.0-SNAPSHOT</version>         </dependency>         <dependency>             <groupId>com.shouke.mvnstudy</groupId>             <artifactId>sub-sub-module</artifactId>             <version>1.0.0-SNAPSHOT</version>         </dependency>     </dependencies>      <parent>         <groupId>com.shouke.mvnstudy</groupId>         <!--父项目id-->         <artifactId>parent-module</artifactId>         <version>1.0.0-SNAPSHOT</version>     </parent>  </project> </xml> 

first-sub-module/sub-sub-module/pom.xml

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelVersion>4.0.0</modelVersion>      <groupId>com.shouke.mvnstudy</groupId>     <artifactId>sub-sub-module</artifactId>     <version>1.0.0-SNAPSHOT</version>      <dependencies>         <!-- junit 依赖 -->         <dependency>             <groupId>junit</groupId>             <artifactId>junit</artifactId>             <version>4.10</version>             <scope>test</scope>         </dependency>     </dependencies> </project> </xml> 

second-sub-module/pom.xml

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelVersion>4.0.0</modelVersion>      <groupId>com.shouke.mvnstudy</groupId>     <artifactId>second-sub-module</artifactId>     <version>1.0.0-SNAPSHOT</version>      <dependencies>         <!-- junit 依赖 -->         <dependency>             <groupId>junit</groupId>             <artifactId>junit</artifactId>             <version>4.10</version>             <scope>test</scope>         </dependency>     </dependencies>      <parent>         <groupId>com.shouke.mvnstudy</groupId>         <!--父项目id-->         <artifactId>parent-module</artifactId>         <version>1.0.0-SNAPSHOT</version>     </parent>  </project> </xml> 

学习实践

-pl选项应用

# mvn clean -Dautoconfig.skip=true -Dmaven.test.skip=true -pl first-sub-module  compile [INFO] Scanning for projects... [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building first-sub-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.219s [INFO] Finished at: Fri Dec 24 11:20:23 CST 2021 [INFO] Final Memory: 17M/1447M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project first-sub-module: Could not resolve dependencies for project com.shouke.mvnstudy:first-sub-module:jar:1.0.0-SNAPSHOT: Could not find artifact com.shouke.mvnstudy:second-sub-module:jar:1.0.0-SNAPSHOT -> [Help 1] [ERROR]  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR]  [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException 

-am选项应用

# mvn clean -Dautoconfig.skip=true -Dmaven.test.skip=true -pl first-sub-module -am compile [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO]  [INFO] parent-module [INFO] second-sub-module [INFO] first-sub-module [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building parent-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ parent-module --- [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building second-sub-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ second-sub-module --- [INFO] Deleting /root/maven-study/second-sub-module/target [INFO]  [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ second-sub-module --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /root/maven-study/second-sub-module/src/main/resources [INFO]  [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ second-sub-module --- [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to /root/maven-study/second-sub-module/target/classes [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building first-sub-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ first-sub-module --- [INFO]  [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ first-sub-module --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /root/maven-study/first-sub-module/src/main/resources [INFO]  [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ first-sub-module --- [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to /root/maven-study/first-sub-module/target/classes [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO]  [INFO] parent-module ..................................... SUCCESS [0.146s] [INFO] second-sub-module ................................. SUCCESS [0.576s] [INFO] first-sub-module .................................. SUCCESS [0.346s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.187s [INFO] Finished at: Fri Dec 24 11:22:06 CST 2021 [INFO] Final Memory: 22M/1096M [INFO] ------------------------------------------------------------------------ 

-amd选项应用

对比示例

# mvn clean -Dautoconfig.skip=true -Dmaven.test.skip=true -pl second-sub-module compile [INFO] Scanning for projects... [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building second-sub-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ second-sub-module --- [INFO]  [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ second-sub-module --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /root/maven-study/second-sub-module/src/main/resources [INFO]  [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ second-sub-module --- [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to /root/maven-study/second-sub-module/target/classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.976s [INFO] Finished at: Fri Dec 24 11:21:18 CST 2021 [INFO] Final Memory: 23M/1447M [INFO] ------------------------------------------------------------------------ 
# mvn clean -Dautoconfig.skip=true -Dmaven.test.skip=true -pl second-sub-module -am compile [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO]  [INFO] parent-module [INFO] second-sub-module [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building parent-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ parent-module --- [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building second-sub-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ second-sub-module --- [INFO] Deleting /root/maven-study/second-sub-module/target [INFO]  [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ second-sub-module --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /root/maven-study/second-sub-module/src/main/resources [INFO]  [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ second-sub-module --- [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to /root/maven-study/second-sub-module/target/classes [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO]  [INFO] parent-module ..................................... SUCCESS [0.132s] [INFO] second-sub-module ................................. SUCCESS [0.536s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.771s [INFO] Finished at: Fri Dec 24 11:24:13 CST 2021 [INFO] Final Memory: 23M/1447M [INFO] ------------------------------------------------------------------------ 

-amd应用示例

# mvn clean -Dautoconfig.skip=true -Dmaven.test.skip=true -pl second-sub-module -amd compile [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO]  [INFO] second-sub-module [INFO] first-sub-module [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building second-sub-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ second-sub-module --- [INFO] Deleting /root/maven-study/second-sub-module/target [INFO]  [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ second-sub-module --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /root/maven-study/second-sub-module/src/main/resources [INFO]  [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ second-sub-module --- [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to /root/maven-study/second-sub-module/target/classes [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building first-sub-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ first-sub-module --- [INFO] Deleting /root/maven-study/first-sub-module/target [INFO]  [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ first-sub-module --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /root/maven-study/first-sub-module/src/main/resources [INFO]  [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ first-sub-module --- [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to /root/maven-study/first-sub-module/target/classes [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO]  [INFO] second-sub-module ................................. SUCCESS [0.652s] [INFO] first-sub-module .................................. SUCCESS [0.344s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.100s [INFO] Finished at: Fri Dec 24 11:24:33 CST 2021 [INFO] Final Memory: 24M/1157M [INFO] ------------------------------------------------------------------------ 

嵌套子模块构建

# mvn clean -Dautoconfig.skip=true -Dmaven.test.skip=true -pl first-sub-module/sub-sub-module compile [INFO] Scanning for projects... [ERROR] Could not find the selected project in the reactor: first-sub-module/sub-sub-module -> [Help 1] [ERROR]  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR]  [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException 

修改first-sub-module/pom.xml

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelVersion>4.0.0</modelVersion>          <groupId>com.shouke.mvnstudy</groupId>     <artifactId>first-sub-module</artifactId>     <version>1.0.0-SNAPSHOT</version>     <packaging>pom</packaging>      <dependencies>         <!-- junit 依赖 -->         <dependency>             <groupId>junit</groupId>             <artifactId>junit</artifactId>             <version>4.10</version>             <scope>test</scope>         </dependency>         <dependency>             <groupId>com.shouke.mvnstudy</groupId>             <artifactId>second-sub-module</artifactId>             <version>1.0.0-SNAPSHOT</version>         </dependency>     </dependencies>      <parent>         <groupId>com.shouke.mvnstudy</groupId>         <!--父项目id-->         <artifactId>parent-module</artifactId>         <version>1.0.0-SNAPSHOT</version>     </parent>          <modules>         <module>sub-sub-module</module>     </modules>  </project> </xml> 

修改first-sub-module/sub-sub-module/pom.xml

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelVersion>4.0.0</modelVersion>      <groupId>com.shouke.mvnstudy</groupId>     <artifactId>sub-sub-module</artifactId>     <version>1.0.0-SNAPSHOT</version>      <dependencies>         <!-- junit 依赖 -->         <dependency>             <groupId>junit</groupId>             <artifactId>junit</artifactId>             <version>4.10</version>             <scope>test</scope>         </dependency>     </dependencies>          <parent>         <groupId>com.shouke.mvnstudy</groupId>         <!--父项目id-->         <artifactId>first-sub-module</artifactId>         <version>1.0.0-SNAPSHOT</version>     </parent> </project> </xml> 
# mvn clean -Dautoconfig.skip=true -Dmaven.test.skip=true -pl first-sub-module/sub-sub-module -am compile [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO]  [INFO] parent-module [INFO] second-sub-module [INFO] first-sub-module [INFO] sub-sub-module [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building parent-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ parent-module --- [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building second-sub-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ second-sub-module --- [INFO] Deleting /root/maven-study/second-sub-module/target [INFO]  [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ second-sub-module --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /root/maven-study/second-sub-module/src/main/resources [INFO]  [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ second-sub-module --- [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to /root/maven-study/second-sub-module/target/classes [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building first-sub-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ first-sub-module --- [INFO] Deleting /root/maven-study/first-sub-module/target [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building sub-sub-module 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ sub-sub-module --- [INFO]  [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ sub-sub-module --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /root/maven-study/first-sub-module/sub-sub-module/src/main/resources [INFO]  [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ sub-sub-module --- [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to /root/maven-study/first-sub-module/sub-sub-module/target/classes [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO]  [INFO] parent-module ..................................... SUCCESS [0.148s] [INFO] second-sub-module ................................. SUCCESS [0.728s] [INFO] first-sub-module .................................. SUCCESS [0.005s] [INFO] sub-sub-module .................................... SUCCESS [0.370s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.370s [INFO] Finished at: Fri Dec 24 11:39:07 CST 2021 [INFO] Final Memory: 22M/1098M [INFO] ------------------------------------------------------------------------ 
结论

注意-pl只适用在“父子”结构的项目中,构建子项目

针对以上结论,修改相关pom.xml,再次测试验证

修改pom.xml

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelVersion>4.0.0</modelVersion>      <groupId>com.shouke.mvnstudy</groupId>     <artifactId>parent-module</artifactId>     <version>1.0.0-SNAPSHOT</version>      <dependencies>         <!-- junit 依赖 -->         <dependency>             <groupId>junit</groupId>             <artifactId>junit</artifactId>             <version>4.10</version>             <scope>test</scope>         </dependency>     </dependencies>     </project> </xml> 

修改second-sub-module/pom.xml

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelVersion>4.0.0</modelVersion>      <groupId>com.shouke.mvnstudy</groupId>     <artifactId>second-sub-module</artifactId>     <version>1.0.0-SNAPSHOT</version>      <dependencies>         <!-- junit 依赖 -->         <dependency>             <groupId>junit</groupId>             <artifactId>junit</artifactId>             <version>4.10</version>             <scope>test</scope>         </dependency>     </dependencies>  </project> </xml> 
# mvn clean -Dautoconfig.skip=true -Dmaven.test.skip=true -pl second-sub-module compile [INFO] Scanning for projects... [ERROR] Could not find the selected project in the reactor: second-sub-module -> [Help 1] [ERROR]  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR]  [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException 

如上,提示找不到模块。

-------------------------------文字太少,占位符---------------------------------

-------------------------------文字太少,占位符---------------------------------

推荐这些技术文章:

Java maven反应堆构建学习实践

Java maven反应堆构建学习实践
实践环境
Apache Maven 3.0.5 (Red Hat 3.0.5-17)
应用示例
示例项目结构
maven示例项目组织结构如下
maven-study
│ pom.xml

├─first-sub-module
│ │ pom.xml
│ │
│ ├─src
│ │ ├─main
│ │ │ └─java
│ │ │...

Java 发送http请求

 
一、httpclient

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version&...

Java:常用pom依赖集合

1. Tomcat依赖和JDK1.8版本注意事项

这些依赖同时都要放在<build><plugins>这里放插件依赖...</plugins></build>这两对标签中

<build>
<plugins>
<!-- ①添加Tomcat依赖 -->
...

【Java/Dependency】ObjectMapper的依赖

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8<...

【Java/dependency】RestTemplate使用的依赖

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.1...

动态代理报错:No default constructor found; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException

缺少依赖
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.8</version>
</dependency>
<dependency>
<group...

2022.4.17 记录---Springboot-Maven个人通用pom文件

查看代码

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mav...

AspectJ 的开发环境(maven依赖)

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>

<dep...

maven 构建的 webapp 基本配置

一、核心依赖
webapp 的依赖,大致分为三部分:基本的 spring 组件依赖、日志及测试组件、web组件依赖等。大致为:

<dependencies>
<!-- 1.base spring dependency -->
<dependency>
<groupId>org.springframework</...

mvn package打包提示:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources

在pom配置文件中增加以下配置即可:

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin&l...

文章标题:Java maven反应堆构建学习实践
文章链接:https://www.dianjilingqu.com/2857.html
本文章来源于网络,版权归原作者所有,如果本站文章侵犯了您的权益,请联系我们删除,联系邮箱:saisai#email.cn,感谢支持理解。
THE END
< <上一篇
下一篇>>