diff --git a/README.md b/README.md index 39b37a7a..3bb1dccf 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ Requirements ------------ * Java 8 +1.1.1 +----- +* Prevent duplicate step implementations being created in the glossary json file. Fixes #62 + 1.1.0 ----- * Moved substeps config to a single org.substeps hierarchy, existing overrides will still be used, but config should be updated diff --git a/runner/Maven/src/main/java/com/technophobia/substeps/glossary/SubstepsGlossaryMojo.java b/runner/Maven/src/main/java/com/technophobia/substeps/glossary/SubstepsGlossaryMojo.java index b68a9765..ee9167f5 100644 --- a/runner/Maven/src/main/java/com/technophobia/substeps/glossary/SubstepsGlossaryMojo.java +++ b/runner/Maven/src/main/java/com/technophobia/substeps/glossary/SubstepsGlossaryMojo.java @@ -47,10 +47,7 @@ import java.io.InputStreamReader; import java.net.MalformedURLException; import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.zip.ZipEntry; @@ -179,20 +176,23 @@ public void executeAfterAllConfigs(Config masterConfig) throws MojoExecutionExce if (masterConfig != null){ List configs = SubstepsConfigLoader.splitMasterConfig(masterConfig); + Set stepImplementationClassNames = new LinkedHashSet<>(); + Set stepImplsToExclude = new LinkedHashSet<>(); + for (Config executionConfig : configs) { - List stepImplementationClassNames = NewSubstepsExecutionConfig.getStepImplementationClassNames(executionConfig); + stepImplementationClassNames.addAll(NewSubstepsExecutionConfig.getStepImplementationClassNames(executionConfig)); - List stepImplsToExclude = NewSubstepsExecutionConfig.getStepImplementationClassNamesGlossaryExcluded(executionConfig); + stepImplsToExclude.addAll(NewSubstepsExecutionConfig.getStepImplementationClassNamesGlossaryExcluded(executionConfig)); + } - if (stepImplsToExclude != null ) { - stepImplementationClassNames.removeAll(stepImplsToExclude); - } + if (stepImplsToExclude != null ) { + stepImplementationClassNames.removeAll(stepImplsToExclude); + } - for (final String classToDocument : stepImplementationClassNames) { + for (final String classToDocument : stepImplementationClassNames) { - classStepTags.addAll(getStepTags(loadedClasses, classRealm, classToDocument)); - } + classStepTags.addAll(getStepTags(loadedClasses, classRealm, classToDocument)); } } else {