diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/ResourceHelper.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/ResourceHelper.groovy index 857b23eb..fa9b96fc 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/ResourceHelper.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/ResourceHelper.groovy @@ -25,8 +25,6 @@ import org.codehaus.plexus.resource.loader.FileResourceLoader import org.codehaus.plexus.resource.ResourceManager import org.codehaus.plexus.util.FileUtils -import java.nio.file.Paths - final class ResourceHelper { Log log @@ -55,11 +53,22 @@ final class ResourceHelper { String location = null String artifact = resource - def file = new File(resource) + // Linux Checks + if (resource.indexOf(SpotBugsInfo.FORWARD_SLASH) != -1) { + artifact = resource.substring(resource.lastIndexOf(SpotBugsInfo.FORWARD_SLASH) + 1) + } + + if (resource.indexOf(SpotBugsInfo.FORWARD_SLASH) != -1) { + location = resource.substring(0, resource.lastIndexOf(SpotBugsInfo.FORWARD_SLASH)) + } + + // Windows Checks + if (resource.indexOf(SpotBugsInfo.BACKWARD_SLASH) != -1) { + artifact = resource.substring(resource.lastIndexOf(SpotBugsInfo.BACKWARD_SLASH) + 1) + } - if (file.exists()) { - artifact = file.getName() - location = file.getAbsolutePath() + if (resource.indexOf(SpotBugsInfo.BACKWARD_SLASH) != -1) { + location = resource.substring(0, resource.lastIndexOf(SpotBugsInfo.BACKWARD_SLASH)) } // replace all occurrences of the following characters: ? : & = diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsInfo.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsInfo.groovy index 3c40cecc..a4ff7b22 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsInfo.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsInfo.groovy @@ -77,6 +77,10 @@ interface SpotBugsInfo { static final String COMMA = "," + static final String FORWARD_SLASH = '/' + + static final String BACKWARD_SLASH = '\\' + /** * The character to separate URL tokens. *