Skip to content

Commit

Permalink
Fixes #115 and believe me, it was NOT fun.
Browse files Browse the repository at this point in the history
In fact, the way we load MavenProject objects is not the official maven way (which will have an impact on #86).
As we load the MavenProject by simply reading the pom file (and not by using the Full Maven Powers), the parent may not be defined and, as a consequence, some infos are lacking.
To fix that, I had to analyze if maven pom is loaded from a file, and when it is the case, I also have to check if parent path is good, which I do a bad way.
  • Loading branch information
Riduidel committed Mar 23, 2022
1 parent 966ffb5 commit 5663b2c
Show file tree
Hide file tree
Showing 6 changed files with 256 additions and 188 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Workspace describeArchitecture() {
architect.uses(maven, "Generates documentation");

Container base = agileArchitecture.addContainer(CONTAINERS_BASE, "Architecture base", "Java executable");
base.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_CLASS, ArchitectureModelProvider.class.getName());
base.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_POM, locate("base/pom.xml"));
base.addProperty(ModelElementKeys.SCM_PATH, base.getName());
// end::structurizr-example-containers[]

Expand Down Expand Up @@ -108,7 +108,7 @@ public Workspace describeArchitecture() {
base.getComponentWithName("SCMReadmeReader").uses(gitLab, "Get project readme");

Component adrTicketsExtractor = base.addComponent("adr-tickets-extractor", "enhanced by maven");
adrTicketsExtractor.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_CLASS, ADRExtractor.class.getName());
adrTicketsExtractor.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_POM, locate("adr-tickets-extractor/pom.xml"));
adrTicketsExtractor.addProperty(ModelElementKeys.SCM_PATH, adrTicketsExtractor.getName());
adrTicketsExtractor.uses(gitLab, "Read tickets from Gitlab if configured so");
adrTicketsExtractor.uses(gitHub, "Read tickets from GitHub if configured so");
Expand All @@ -120,7 +120,7 @@ public Workspace describeArchitecture() {
base.getComponentWithName("ArchitectureDocumentationBuilder").uses(cdiConfigExtension, "Eases out some CDI code");

Component mavenEnhancer = base.addComponent("maven-metadata-inferer", "Enhanced by Maven");
cdiConfigExtension.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_CLASS, MavenEnhancer.class.getName());
cdiConfigExtension.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_POM, locate("maven-metadata-inferer/pom.xml"));
cdiConfigExtension.addProperty(ModelElementKeys.SCM_PATH, mavenEnhancer.getName());
base.getComponentWithName("ArchitectureDocumentationBuilder").uses(mavenEnhancer, "Infer most of element details from Maven infos");

Expand Down
6 changes: 6 additions & 0 deletions base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
<dependency>
<groupId>com.structurizr</groupId>
<artifactId>structurizr-client</artifactId>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.structurizr</groupId>
Expand Down
6 changes: 6 additions & 0 deletions github-scm-handler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<groupId>io.github.Riduidel.agile-architecture-documentation-system</groupId>
<artifactId>base</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ static String getGitHubProjectName(String project) {
if(project.startsWith("/")) {
project = project.substring(1);
}
if(project.endsWith(".git")) {
project = project.substring(0, project.indexOf(".git"));
}
return project;
}

Expand Down
Loading

0 comments on commit 5663b2c

Please sign in to comment.