是什么导致了这个 ArchUnit 异常?
What causes this ArchUnit exception?
感谢您的宝贵时间,
我一直在尝试使用 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]
我有一个相当标准的 plantuml 图;尽管我不想分享它,但 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
@Thomas 让我思考问题的根源,我已经解决了它,如下所示:
问题是作为我对组件 (A) 的描述的一部分的包太模糊了,以至于对另一个组件 (B) 的描述也可以考虑该组件 (A),所以我的一些 类 被认为属于 >=2 个组件。
感谢您的宝贵时间,
我一直在尝试使用 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]
我有一个相当标准的 plantuml 图;尽管我不想分享它,但 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
@Thomas 让我思考问题的根源,我已经解决了它,如下所示:
问题是作为我对组件 (A) 的描述的一部分的包太模糊了,以至于对另一个组件 (B) 的描述也可以考虑该组件 (A),所以我的一些 类 被认为属于 >=2 个组件。