hudson.plugins.tasks.util.MavenModuleDetector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tasks Show documentation
Show all versions of tasks Show documentation
This plug-in scans the workspace files for open tasks
and generates a trend report.
package hudson.plugins.tasks.util;
import org.apache.commons.lang.StringUtils;
/**
* Detects maven module names by parsing the name of a source file.
*/
public final class MavenModuleDetector {
/**
* Guesses a maven module name based on the source folder.
*
* @param fileName
* the absolute path of the file (UNIX style) to guess the module
* for
* @return the guessed module name or an empty string
*/
public static String guessModuleName(final String fileName) {
if (fileName.contains("/src")) {
String module = StringUtils.substringBefore(fileName, "/src/");
if (module.contains("/")) {
module = StringUtils.substringAfterLast(module, "/");
}
if (StringUtils.isNotBlank(module)) {
return module;
}
}
return StringUtils.EMPTY;
}
/**
* Creates a new instance of MavenModuleDetector
.
*/
private MavenModuleDetector() {
// prevents instantiation
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy