diff --git a/README.md b/README.md index 1b5add1d..8e4255ef 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,11 @@ Requirements * Java 8 * Scala 2.12.3 (included) +1.1.4 +----- +* Fix for #77 Glossary Builder mojo unable to load step implementation meta information from jars + + 1.1.3 ----- * Changed the root report page to be index.html. Added a redirect page in for the old. diff --git a/pom.xml b/pom.xml index 9ad07657..845aa057 100644 --- a/pom.xml +++ b/pom.xml @@ -491,7 +491,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.6 + 1.6.7 true @@ -502,8 +502,7 @@ r${java.version} - - false + true 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 78a07c59..5f47a993 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 @@ -245,38 +245,50 @@ private List getStepTags(HashSet loadedCl // where is this class ? final JarFile jarFileForClass = getJarFileForClass(classToDocument); - if (jarFileForClass != null) { - log.debug("loading info from jar"); + try { + if (jarFileForClass != null) { - // look for the xml file in the jar, load up from - // there - loadStepTagsFromJar(jarFileForClass, classStepTags, loadedClasses); - } else { - log.debug("loading step info from paths"); - // if it's in the project, run the javadoc and collect the - // details + log.debug("loading info from jar"); - // TODO - if this class is annotated with AdditionalStepImplementations, lookup those instead.. + // look for the xml file in the jar, load up from + // there + loadStepTagsFromJar(jarFileForClass, classStepTags, loadedClasses); + } else { + log.debug("loading step info from paths"); + // if it's in the project, run the javadoc and collect the + // details - try { - Class stepImplClass = classRealm.loadClass(classToDocument); + // TODO - if this class is annotated with AdditionalStepImplementations, lookup those instead.. - SubSteps.AdditionalStepImplementations additionalStepImpls = stepImplClass.getDeclaredAnnotation(SubSteps.AdditionalStepImplementations.class); + try { + Class stepImplClass = classRealm.loadClass(classToDocument); - if (additionalStepImpls != null) { - for (Class c : additionalStepImpls.value()) { + SubSteps.AdditionalStepImplementations additionalStepImpls = stepImplClass.getDeclaredAnnotation(SubSteps.AdditionalStepImplementations.class); - classStepTags.addAll(runJavaDoclet(c.getCanonicalName())); + if (additionalStepImpls != null) { + for (Class c : additionalStepImpls.value()) { + + classStepTags.addAll(runJavaDoclet(c.getCanonicalName())); + } } - } - } catch (ClassNotFoundException e) { - log.error("failed to load class: " + classToDocument, e); + } catch (ClassNotFoundException e) { + log.error("failed to load class: " + classToDocument, e); - } + } - classStepTags.addAll(runJavaDoclet(classToDocument)); + classStepTags.addAll(runJavaDoclet(classToDocument)); + } + } + finally { + if (jarFileForClass != null){ + try { + jarFileForClass.close(); + } catch (IOException e) { + log.debug("ioexcception closing jar file", e); + } + } } } return classStepTags; @@ -326,7 +338,6 @@ private void loadStepTagsFromJar(final JarFile jarFileForClass, if (entry != null) { - try { final InputStream is = jarFileForClass.getInputStream(entry); InputStreamReader isr = new InputStreamReader(is); @@ -377,15 +388,15 @@ private JarFile getJarFileForClass(final String className) { } catch (final IOException e) { log.error("IO Exception opening jar file", e); } - finally { - if (tempJarFile != null){ - try { - tempJarFile.close(); - } catch (IOException e) { - log.debug("ioexcception closing jar file", e); - } - } - } +// finally { +// if (tempJarFile != null){ +// try { +// tempJarFile.close(); +// } catch (IOException e) { +// log.debug("ioexcception closing jar file", e); +// } +// } +// } } } return jarFile;