@@ -183,55 +183,87 @@ public enum OtherVersions {
183183 * imagej-maven-plugin.
184184 */
185185 void handleBackwardCompatibility() {
186- ExpressionEvaluator evaluator = new PluginParameterExpressionEvaluator(session, mojoExecution);
186+ ExpressionEvaluator evaluator = new PluginParameterExpressionEvaluator(
187+ session, mojoExecution);
187188
188189 try {
189190 // If at least one scijava.* property is set, ignore imagej.* properties
190191 if (evaluator.evaluate("${" + appDirectoryProperty + "}") == null &&
191192 evaluator.evaluate("${" + appSubdirectoryProperty + "}") == null &&
192- evaluator.evaluate("${" + deleteOtherVersionsPolicyProperty + "}") == null)
193+ evaluator.evaluate("${" + deleteOtherVersionsPolicyProperty +
194+ "}") == null)
193195 {
194196
195197 // Keep backwards compatibility to delete.other.versions
196- if (evaluator.evaluate("${"+deleteOtherVersionsProperty+"}") != null) {
197- getLog().warn("Property '" + deleteOtherVersionsProperty + "' is deprecated. Use '"+ deleteOtherVersionsPolicyProperty +"' instead");
198- deleteOtherVersionsPolicy = deleteOtherVersions ? OtherVersions.older : OtherVersions.never;
198+ if (evaluator.evaluate("${" + deleteOtherVersionsProperty +
199+ "}") != null)
200+ {
201+ getLog().warn("Property '" + deleteOtherVersionsProperty +
202+ "' is deprecated. Use '" + deleteOtherVersionsPolicyProperty +
203+ "' instead");
204+ deleteOtherVersionsPolicy = deleteOtherVersions ? OtherVersions.older
205+ : OtherVersions.never;
199206 }
200207
201208 // Keep backwards compatibility to imagej.app.directory
202- // Use imagejDirectory if it is set (directly or via imagej.app.directory)
209+ // Use imagejDirectory if it is set (directly or via
210+ // imagej.app.directory)
203211 if (imagejDirectory != null) {
204- if (evaluator.evaluate("${"+imagejDirectoryProperty+"}") == null) {
205- getLog().warn("Configuration property 'imagejDirectory' is deprecated. Use 'appDirectory' instead");
206- } else {
207- getLog().warn("Property '" + imagejDirectoryProperty + "' is deprecated. Use '"+ appDirectoryProperty +"' instead");
212+ if (evaluator.evaluate("${" + imagejDirectoryProperty +
213+ "}") == null)
214+ {
215+ getLog().warn(
216+ "Configuration property 'imagejDirectory' is deprecated." +
217+ "Use 'appDirectory' instead");
218+ }
219+ else {
220+ getLog().warn("Property '" + imagejDirectoryProperty +
221+ "' is deprecated. Use '" + appDirectoryProperty + "' instead");
208222 }
209223 appDirectory = imagejDirectory;
210224 }
211225
212226 // Keep backwards compatibility to imagej.app.subdirectory
213- // Use imagejSubdirectory if it is set (directly or via imagej.app.subdirectory)
227+ // Use imagejSubdirectory if it is set (directly or via
228+ // imagej.app.subdirectory)
214229 if (imagejSubdirectory != null) {
215- if (evaluator.evaluate("${"+imagejSubdirectoryProperty+"}") == null) {
216- getLog().warn("Configuration property 'imagejSubdirectory' is deprecated. Use 'appSubdirectory' instead");
217- } else {
218- getLog().warn("Property '" + imagejSubdirectoryProperty + "' is deprecated. Use '"+ appSubdirectoryProperty +"' instead");
230+ if (evaluator.evaluate("${" + imagejSubdirectoryProperty +
231+ "}") == null)
232+ {
233+ getLog().warn(
234+ "Configuration property 'imagejSubdirectory' is deprecated." +
235+ "Use 'appSubdirectory' instead");
236+ }
237+ else {
238+ getLog().warn("Property '" + imagejSubdirectoryProperty +
239+ "' is deprecated. Use '" + appSubdirectoryProperty + "' instead");
219240 }
220241 appSubdirectory = imagejSubdirectory;
221242 }
222243
223244 // Keep backwards compatibility to imagej.deleteOtherVersions
224- // Use imagejDeleteOtherVersionsPolicy if it is set (directly or via imagej.deleteOtherVersions)
245+ // Use imagejDeleteOtherVersionsPolicy if it is set (directly or via
246+ // imagej.deleteOtherVersions)
225247 if (imagejDeleteOtherVersionsPolicy != null) {
226- if (evaluator.evaluate("${"+imagejDeleteOtherVersionsPolicyProperty+"}") == null) {
227- getLog().warn("Configuration property 'imagejDeleteOtherVersionsPolicy' is deprecated. Use 'deleteOtherVersionsPolicy' instead");
228- } else {
229- getLog().warn("Property '" + imagejDeleteOtherVersionsPolicyProperty + "' is deprecated. Use '"+ deleteOtherVersionsPolicyProperty +"' instead");
248+ if (evaluator.evaluate("${" +
249+ imagejDeleteOtherVersionsPolicyProperty + "}") == null)
250+ {
251+ getLog().warn(
252+ "Configuration property 'imagejDeleteOtherVersionsPolicy' is deprecated." +
253+ "Use 'deleteOtherVersionsPolicy' instead");
254+ }
255+ else {
256+ getLog().warn("Property '" +
257+ imagejDeleteOtherVersionsPolicyProperty +
258+ "' is deprecated. Use '" + deleteOtherVersionsPolicyProperty +
259+ "' instead");
230260 }
231261 deleteOtherVersionsPolicy = imagejDeleteOtherVersionsPolicy;
232262 }
233- } else {
234- getLog().info("At least one scijava.* property is set. Ignoring imagej.* properties");
263+ }
264+ else {
265+ getLog().info(
266+ "At least one scijava.* property is set. Ignoring imagej.* properties");
235267 }
236268 }
237269 catch (ExpressionEvaluationException e) {
@@ -292,41 +324,41 @@ protected String interpolate(final String original,
292324 }
293325
294326 protected void installArtifact(final Artifact artifact,
295- final File imagejDirectory , final boolean force,
327+ final File appDirectory , final boolean force,
296328 final OtherVersions otherVersionsPolicy) throws IOException
297329 {
298- installArtifact(artifact, imagejDirectory , "", force, otherVersionsPolicy);
330+ installArtifact(artifact, appDirectory , "", force, otherVersionsPolicy);
299331 }
300332
301333 protected void installArtifact(final Artifact artifact,
302- final File imagejDirectory , final String subdirectory , final boolean force,
334+ final File appDirectory , final String appSubdirectory , final boolean force,
303335 final OtherVersions otherVersionsPolicy) throws IOException
304336 {
305337 if (!"jar".equals(artifact.getType())) return;
306338
307339 final File source = artifact.getFile();
308340 final File targetDirectory;
309341
310- if (subdirectory != null && !subdirectory .equals("")) {
311- targetDirectory = new File(imagejDirectory, subdirectory );
342+ if (appSubdirectory != null && !appSubdirectory .equals("")) {
343+ targetDirectory = new File(appDirectory, appSubdirectory );
312344 } else if (isIJ1Plugin(source)) {
313- targetDirectory = new File(imagejDirectory , "plugins");
345+ targetDirectory = new File(appDirectory , "plugins");
314346 }
315347 else if ("ome".equals(artifact.getGroupId()) ||
316348 ("loci".equals(artifact.getGroupId()) && (source.getName().startsWith(
317349 "scifio-4.4.") || source.getName().startsWith("jai_imageio-4.4."))))
318350 {
319- targetDirectory = new File(imagejDirectory , "jars/bio-formats");
351+ targetDirectory = new File(appDirectory , "jars/bio-formats");
320352 }
321353 else {
322- targetDirectory = new File(imagejDirectory , "jars");
354+ targetDirectory = new File(appDirectory , "jars");
323355 }
324356 final String fileName = "Fiji_Updater".equals(artifact.getArtifactId())
325357 ? artifact.getArtifactId() + ".jar" : source.getName();
326358 final File target = new File(targetDirectory, fileName);
327359
328360 boolean newerVersion = false;
329- final Path directoryPath = Paths.get(imagejDirectory .toURI());
361+ final Path directoryPath = Paths.get(appDirectory .toURI());
330362 final Path targetPath = Paths.get(target.toURI());
331363 final Collection<Path> otherVersions = //
332364 getEncroachingVersions(directoryPath, targetPath);
@@ -422,8 +454,8 @@ private static boolean isIJ1Plugin(final File file) {
422454 */
423455 private String majorVersion( String v )
424456 {
425- final int dot = v.indexOf('.');
426- return dot < 0 ? v : v.substring(0, dot);
457+ final int dot = v.indexOf('.');
458+ return dot < 0 ? v : v.substring(0, dot);
427459 }
428460
429461 /**
0 commit comments