说明:如果按照这种方式http://www.cnblogs.com/EasonJim/p/8303878.html,且按照常规的install方式在子项目中编译项目,那么需要先install一下parent项目,最后才能编译子项目。这种方式其实不太好,每次都intall一大堆项目,所以为了解决这种重的方式,可以只install公共模块,然后使其单独能编译子项目。

解决方式:

1、在常规新建的多模块项目(http://www.cnblogs.com/EasonJim/p/6863987.html)时,把公共模块的pom的parent节点去除即可。比如样例工程bus-core-api下的pom如下:

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jsoft.test</groupId>
<artifactId>testproject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<groupId>com.jsoft.test</groupId>
<artifactId>bus-core-api</artifactId>
<version>1.0-SNAPSHOT</version>
<name>bus-core-api</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

去除了parent节点后是这样的:

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jsoft.test</groupId>
<artifactId>bus-core-api</artifactId>
<version>1.0-SNAPSHOT</version>
<name>bus-core-api</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

那么这样操作之后,直接install了bus-core-api之后就可以单独编译app-desktop-ui等项目。

注意:子模块去除了parent节点之后,随着而来的特性也会丢失,比如在父项目定义的配置项,那么也不能使用,比如父项目增加的包,那么在子项目也不能继承使用,只能单独自己引入。

测试工程:https://github.com/easonjim/5_java_example/tree/master/maventest/test10/testproject

最新文章

  1. 使用用户自定义类型 CLR UDT
  2. 用shebang编写一个ssh自动登陆脚本
  3. encodeURI来解决URL传递时的中文问题
  4. JAVA Day6
  5. 程序设计入门—Java语言 第六周编程题 1 单词长度(4分)
  6. 浅谈压缩感知(二十八):压缩感知重构算法之广义正交匹配追踪(gOMP)
  7. Day5_作业
  8. maven项目搭建
  9. A few things to remember while coding in Python.
  10. jquery插件--多行文本缩略
  11. 【转】shell学习笔记(七)——流程控制之while
  12. linux 3.10 串口注册
  13. CF877F
  14. Flume+Kafka+Storm+Hbase+HDSF+Poi整合
  15. 精心收集的 95 个超实用的 JavaScript 代码片段( ES6+ 编写)
  16. TODO java疑问
  17. CAP:Alantany 谈 CAP
  18. 瀑布 敏捷 精益 devops
  19. RocketMQ 消息发送
  20. talib 中文文档(十五):Math Operator Functions 数学方法

热门文章

  1. elemetUi 组件--el-upload
  2. 查看jar包源码
  3. HDU5772 String problem
  4. bzoj 2753 最小生成树变形
  5. wget.vbs &amp; wget.ps1
  6. 应对ubuntu linux图形界面卡住的方法
  7. Ring0层创建事件,Ring3层接收
  8. Django【进阶】信号
  9. unicode字符串解码显示
  10. Swift 学习之二十一:?和 !(详解)