1
我有类似鸡蛋和鸡的问题。我有两个兄弟儿童模组。异常处理包位于MDP模块中。 MDP模块还会查找Transformer模块的参考。Maven:兄弟姐妹继承
<dependency>
<groupId>dcconverter</groupId>
<artifactId>transformer</artifactId>
<version>${converter-shell}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>dcconverter</groupId>
<artifactId>validate</artifactId>
<version>${converter-shell}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
因此,为了构建MDP模块,必须先构建变压器,因为它是一个依赖项。我希望在Transformer模块中实现ExceptionHandling。除非我将MDP模块声明为依赖项,否则它不能访问MDP类。这里存在蛋和鸡的问题。
现在,我可以将异常处理移动到Validate模块中,该模块没有解决问题的同级依赖关系。不过,我仍然需要列出所有依赖Validate的兄弟。这是好的做法吗?或者有没有办法绕过这些相互依赖的兄弟姐妹?