diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 26d5f1f..06fa0f3 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -7,7 +7,7 @@ 3. Overseer option: `overseer`. If this option is on, the plugin will look for external reports and sources automatically following the [Overseer.md](./Overseer.md) document rules 4. GoLang Coverage Support (`.out` files) -#### Release 0.3.0 - Upcoming +#### Release 0.3.0 - 2022/02/14 1. Refactoring - Current version still has a lot of code that can be reused. 2. Option `OMNI_LOG` with environment variable. Logs everything into `target/omni.log` file (Not configurable yet) diff --git a/src/main/kotlin/org/jesperancinha/plugins/omni/reporter/domain/reports/OmniFileAdapters.kt b/src/main/kotlin/org/jesperancinha/plugins/omni/reporter/domain/reports/OmniFileAdapters.kt index cc871d4..3055076 100644 --- a/src/main/kotlin/org/jesperancinha/plugins/omni/reporter/domain/reports/OmniFileAdapters.kt +++ b/src/main/kotlin/org/jesperancinha/plugins/omni/reporter/domain/reports/OmniFileAdapters.kt @@ -19,14 +19,16 @@ internal val JAR_FILE_PATTERNS = */ internal fun File.findJarFile(): File? = JAR_FILE_PATTERNS.firstNotNullOfOrNull { pattern -> - val first = this.walkTopDown() - .toList().firstOrNull { file -> + val allMatches = this.walkTopDown() + .toList().filter { file -> val absolutePath = file.absolutePath.lowercase() absolutePath.matches(Regex(pattern)) && !absolutePath.contains("assembly") && !absolutePath.endsWith("sources.jar") && !absolutePath.endsWith("javadoc.jar") } + val plains = allMatches.filter { it.absolutePath.endsWith("plain.jar") } + val first = if (plains.isEmpty()) allMatches.firstOrNull() else plains[0] first }