Skip to content

Commit c2da6d8

Browse files
committed
AbstractInstallMojo: refactor case logic
Bio-Formats detection hack is complex enough to warrant its own method.
1 parent 90ba934 commit c2da6d8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/main/java/org/scijava/maven/plugin/install/AbstractInstallMojo.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,11 @@ protected void installArtifact(final Artifact artifact,
195195

196196
if (appSubdir != null && !appSubdir.equals("")) {
197197
targetDirectory = new File(appDir, appSubdir);
198-
} else if (isIJ1Plugin(source)) {
198+
}
199+
else if (isIJ1Plugin(source)) {
199200
targetDirectory = new File(appDir, "plugins");
200201
}
201-
else if ("ome".equals(artifact.getGroupId()) ||
202-
("loci".equals(artifact.getGroupId()) && (source.getName().startsWith(
203-
"scifio-4.4.") || source.getName().startsWith("jai_imageio-4.4."))))
204-
{
202+
else if (isBioFormatsArtifact(artifact)) {
205203
targetDirectory = new File(appDir, "jars/bio-formats");
206204
}
207205
else {
@@ -269,6 +267,13 @@ else if (newerVersion) {
269267
}
270268
}
271269

270+
private static boolean isBioFormatsArtifact(final Artifact artifact) {
271+
final String fileName = artifact.getFile().getName();
272+
return "ome".equals(artifact.getGroupId()) ||
273+
("loci".equals(artifact.getGroupId()) && (fileName.startsWith(
274+
"scifio-4.4.") || fileName.startsWith("jai_imageio-4.4.")));
275+
}
276+
272277
private static boolean isIJ1Plugin(final File file) {
273278
final String name = file.getName();
274279
if (name.indexOf('_') < 0 || !file.exists()) return false;

0 commit comments

Comments
 (0)