0

谢谢你的时间,

我一直在尝试使用 Archunit,但我无法解决这个问题:

ComponentIntersectionException: Class 
com.yyy.xxx.common.configurations.properties.SomeClass may not be contained in more 
than one component, but is contained in [Common, Configuration]

我有一个相当标准的植物图;虽然我不想分享它,但 ArchUnit 可能有一些细微差别,我错过了。我的问题是,具体来说,在高层次上,我必须做错什么吗?

附加信息:测试:

    @Test
    void diagram_layersShouldBeRespected() throws IOException {
        classes().should(adhereToPlantUmlDiagram(PLANTUML_YAMl, consideringOnlyDependenciesInDiagram())).check(ALL_PROJECT_CLASSES);
    }

yaml:

@startuml
 
package "Config" {
  [Configuration] <<..configurations.properties..>>
//this is where SomeClass resides
}
 
package "Web Layer" {
  [Controller] <<..web.controllers..>>
  [Resources] <<..web.resources..>>
}
 
package "Business Layer" {
  [Services] <<..services..>>
  [Business Model] <<..models..>>
}
 
package "Adapter Layer" {
  [Databases] <<..dataaccess..>>
  [Integration] <<..adapters.azure..>> 
  [Storage] <<..adapters.azure.storage..>> 
}
 
package "Common Layer" {
  [Common] <<..common..>>
}
 
[Configuration] --> [Services]
[Configuration] --> [Storage]
[Configuration] --> [Common]
[Configuration] --> [Configuration]
[Common] --> [Configuration]
 
[Controller] --> [Resources]
[Controller] --> [Services]
[Controller] --> [Common]
[Resources] --> [Common]
 
[Services] --> [Databases]
[Services] --> [Integration]
[Services] --> [Storage]
[Services] --> [Common]
 
[Databases] --> [Common]
[Integration] --> [Common]
[Storage] --> [Common]
 
@enduml
4

1 回答 1

0

正如@Thomas 让我思考问题的根源所在,我已经解决了它,如下所示:

问题是作为我对组件(A)的描述的一部分的包太模糊了,以至于另一个组件(B)的描述也可以被认为是那个组件(A),所以我的一些类是被认为属于> = 2个组件。

于 2021-10-21T08:37:44.507 回答