Skip to content

Commit 2150a0c

Browse files
committed
AbstractCopyJarsMojo: fix naming of constants
Java constants should be in capital case with underscores. There is also no reason for these constants to be public.
1 parent e31fa30 commit 2150a0c

File tree

4 files changed

+40
-40
lines changed

4 files changed

+40
-40
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111

1212
<artifactId>scijava-maven-plugin</artifactId>
13-
<version>1.1.2-SNAPSHOT</version>
13+
<version>2.0.0-SNAPSHOT</version>
1414
<packaging>maven-plugin</packaging>
1515

1616
<name>SciJava plugin for Maven</name>

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

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public abstract class AbstractCopyJarsMojo extends AbstractMojo {
8282
* </p>
8383
*/
8484
@Deprecated
85-
@Parameter(property = imagejDirectoryProperty, required = false)
85+
@Parameter(property = IMAGEJ_DIRECTORY_PROPERTY, required = false)
8686
String imagejDirectory;
8787

8888
/**
@@ -92,7 +92,7 @@ public abstract class AbstractCopyJarsMojo extends AbstractMojo {
9292
* If it is not a directory, no .jar files are copied.
9393
* </p>
9494
*/
95-
@Parameter(property = appDirectoryProperty, required = false)
95+
@Parameter(property = APP_DIRECTORY_PROPERTY, required = false)
9696
String appDirectory;
9797

9898
/**
@@ -103,7 +103,7 @@ public abstract class AbstractCopyJarsMojo extends AbstractMojo {
103103
* </p>
104104
*/
105105
@Deprecated
106-
@Parameter(property = imagejSubdirectoryProperty, required = false)
106+
@Parameter(property = IMAGEJ_SUBDIRECTORY_PROPERTY, required = false)
107107
String imagejSubdirectory;
108108

109109
/**
@@ -113,7 +113,7 @@ public abstract class AbstractCopyJarsMojo extends AbstractMojo {
113113
* If no property of that name exists, no subdirectory will be used.
114114
* </p>
115115
*/
116-
@Parameter(property = appSubdirectoryProperty, required = false)
116+
@Parameter(property = APP_SUBDIRECTORY_PROPERTY, required = false)
117117
String appSubdirectory;
118118

119119
/**
@@ -125,7 +125,7 @@ public abstract class AbstractCopyJarsMojo extends AbstractMojo {
125125
* </p>
126126
*/
127127
@Deprecated
128-
@Parameter(property = deleteOtherVersionsProperty)
128+
@Parameter(property = DELETE_OTHER_VERSIONS_PROPERTY)
129129
boolean deleteOtherVersions;
130130

131131
/**
@@ -137,7 +137,7 @@ public abstract class AbstractCopyJarsMojo extends AbstractMojo {
137137
* </p>
138138
*/
139139
@Deprecated
140-
@Parameter(property = imagejDeleteOtherVersionsPolicyProperty)
140+
@Parameter(property = IMAGEJ_DELETE_OTHER_VERSIONS_POLICY_PROPERTY)
141141
OtherVersions imagejDeleteOtherVersionsPolicy;
142142

143143
/**
@@ -148,14 +148,14 @@ public abstract class AbstractCopyJarsMojo extends AbstractMojo {
148148
* other versions.
149149
* </p>
150150
*/
151-
@Parameter(property = deleteOtherVersionsPolicyProperty, defaultValue = "older")
151+
@Parameter(property = DELETE_OTHER_VERSIONS_POLICY_PROPERTY, defaultValue = "older")
152152
OtherVersions deleteOtherVersionsPolicy;
153153

154154
/**
155155
* If this option is set to <code>true</code>, only the artifact will be
156156
* copied - without its dependencies.
157157
*/
158-
@Parameter(property = ignoreDependenciesProperty, defaultValue = "false")
158+
@Parameter(property = IGNORE_DEPENDENCIES_PROPERTY, defaultValue = "false")
159159
boolean ignoreDependencies;
160160

161161
@Parameter(defaultValue = "${session}")
@@ -164,15 +164,15 @@ public abstract class AbstractCopyJarsMojo extends AbstractMojo {
164164
@Parameter( defaultValue = "${mojoExecution}", readonly = true )
165165
MojoExecution mojoExecution;
166166

167-
public static final String imagejDirectoryProperty = "imagej.app.directory";
168-
public static final String imagejSubdirectoryProperty = "imagej.app.subdirectory";
169-
public static final String deleteOtherVersionsProperty = "delete.other.versions";
170-
public static final String imagejDeleteOtherVersionsPolicyProperty = "imagej.deleteOtherVersions";
167+
protected static final String IMAGEJ_DIRECTORY_PROPERTY = "imagej.app.directory";
168+
protected static final String IMAGEJ_SUBDIRECTORY_PROPERTY = "imagej.app.subdirectory";
169+
protected static final String DELETE_OTHER_VERSIONS_PROPERTY = "delete.other.versions";
170+
protected static final String IMAGEJ_DELETE_OTHER_VERSIONS_POLICY_PROPERTY = "imagej.deleteOtherVersions";
171171

172-
public static final String appDirectoryProperty = "scijava.app.directory";
173-
public static final String appSubdirectoryProperty = "scijava.app.subdirectory";
174-
public static final String deleteOtherVersionsPolicyProperty = "scijava.deleteOtherVersions";
175-
public static final String ignoreDependenciesProperty = "scijava.ignoreDependencies";
172+
protected static final String APP_DIRECTORY_PROPERTY = "scijava.app.directory";
173+
protected static final String APP_SUBDIRECTORY_PROPERTY = "scijava.app.subdirectory";
174+
protected static final String DELETE_OTHER_VERSIONS_POLICY_PROPERTY = "scijava.deleteOtherVersions";
175+
protected static final String IGNORE_DEPENDENCIES_PROPERTY = "scijava.ignoreDependencies";
176176

177177
public enum OtherVersions {
178178
always, older, never
@@ -188,18 +188,18 @@ void handleBackwardCompatibility() {
188188

189189
try {
190190
// If at least one scijava.* property is set, ignore imagej.* properties
191-
if (evaluator.evaluate("${" + appDirectoryProperty + "}") == null &&
192-
evaluator.evaluate("${" + appSubdirectoryProperty + "}") == null &&
193-
evaluator.evaluate("${" + deleteOtherVersionsPolicyProperty +
191+
if (evaluator.evaluate("${" + APP_DIRECTORY_PROPERTY + "}") == null &&
192+
evaluator.evaluate("${" + APP_SUBDIRECTORY_PROPERTY + "}") == null &&
193+
evaluator.evaluate("${" + DELETE_OTHER_VERSIONS_POLICY_PROPERTY +
194194
"}") == null)
195195
{
196196

197197
// Keep backwards compatibility to delete.other.versions
198-
if (evaluator.evaluate("${" + deleteOtherVersionsProperty +
198+
if (evaluator.evaluate("${" + DELETE_OTHER_VERSIONS_PROPERTY +
199199
"}") != null)
200200
{
201-
getLog().warn("Property '" + deleteOtherVersionsProperty +
202-
"' is deprecated. Use '" + deleteOtherVersionsPolicyProperty +
201+
getLog().warn("Property '" + DELETE_OTHER_VERSIONS_PROPERTY +
202+
"' is deprecated. Use '" + DELETE_OTHER_VERSIONS_POLICY_PROPERTY +
203203
"' instead");
204204
deleteOtherVersionsPolicy = deleteOtherVersions ? OtherVersions.older
205205
: OtherVersions.never;
@@ -209,16 +209,16 @@ void handleBackwardCompatibility() {
209209
// Use imagejDirectory if it is set (directly or via
210210
// imagej.app.directory)
211211
if (imagejDirectory != null) {
212-
if (evaluator.evaluate("${" + imagejDirectoryProperty +
212+
if (evaluator.evaluate("${" + IMAGEJ_DIRECTORY_PROPERTY +
213213
"}") == null)
214214
{
215215
getLog().warn(
216216
"Configuration property 'imagejDirectory' is deprecated." +
217217
"Use 'appDirectory' instead");
218218
}
219219
else {
220-
getLog().warn("Property '" + imagejDirectoryProperty +
221-
"' is deprecated. Use '" + appDirectoryProperty + "' instead");
220+
getLog().warn("Property '" + IMAGEJ_DIRECTORY_PROPERTY +
221+
"' is deprecated. Use '" + APP_DIRECTORY_PROPERTY + "' instead");
222222
}
223223
appDirectory = imagejDirectory;
224224
}
@@ -227,16 +227,16 @@ void handleBackwardCompatibility() {
227227
// Use imagejSubdirectory if it is set (directly or via
228228
// imagej.app.subdirectory)
229229
if (imagejSubdirectory != null) {
230-
if (evaluator.evaluate("${" + imagejSubdirectoryProperty +
230+
if (evaluator.evaluate("${" + IMAGEJ_SUBDIRECTORY_PROPERTY +
231231
"}") == null)
232232
{
233233
getLog().warn(
234234
"Configuration property 'imagejSubdirectory' is deprecated." +
235235
"Use 'appSubdirectory' instead");
236236
}
237237
else {
238-
getLog().warn("Property '" + imagejSubdirectoryProperty +
239-
"' is deprecated. Use '" + appSubdirectoryProperty + "' instead");
238+
getLog().warn("Property '" + IMAGEJ_SUBDIRECTORY_PROPERTY +
239+
"' is deprecated. Use '" + APP_SUBDIRECTORY_PROPERTY + "' instead");
240240
}
241241
appSubdirectory = imagejSubdirectory;
242242
}
@@ -246,16 +246,16 @@ void handleBackwardCompatibility() {
246246
// imagej.deleteOtherVersions)
247247
if (imagejDeleteOtherVersionsPolicy != null) {
248248
if (evaluator.evaluate("${" +
249-
imagejDeleteOtherVersionsPolicyProperty + "}") == null)
249+
IMAGEJ_DELETE_OTHER_VERSIONS_POLICY_PROPERTY + "}") == null)
250250
{
251251
getLog().warn(
252252
"Configuration property 'imagejDeleteOtherVersionsPolicy' is deprecated." +
253253
"Use 'deleteOtherVersionsPolicy' instead");
254254
}
255255
else {
256256
getLog().warn("Property '" +
257-
imagejDeleteOtherVersionsPolicyProperty +
258-
"' is deprecated. Use '" + deleteOtherVersionsPolicyProperty +
257+
IMAGEJ_DELETE_OTHER_VERSIONS_POLICY_PROPERTY +
258+
"' is deprecated. Use '" + DELETE_OTHER_VERSIONS_POLICY_PROPERTY +
259259
"' instead");
260260
}
261261
deleteOtherVersionsPolicy = imagejDeleteOtherVersionsPolicy;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ public void execute() throws MojoExecutionException {
9696

9797
if (appDirectory == null) {
9898
if (hasIJ1Dependency(project)) getLog().info(
99-
"Property '" + appDirectoryProperty + "' unset; Skipping copy-jars");
99+
"Property '" + APP_DIRECTORY_PROPERTY + "' unset; Skipping copy-jars");
100100
return;
101101
}
102102
final String interpolated = interpolate(appDirectory, project, session);
103103
appDir = new File(interpolated);
104104

105105
if (appSubdirectory == null) {
106-
getLog().info("No property name for the " + appSubdirectoryProperty +
106+
getLog().info("No property name for the " + APP_SUBDIRECTORY_PROPERTY +
107107
" directory location was specified; Installing in default location");
108108
}
109109

@@ -140,7 +140,7 @@ public void execute() throws MojoExecutionException {
140140
if (!ignoreDependencies) {
141141
ProjectBuildingResult build = mavenProjectBuilder.build(result.getArtifact(), session.getProjectBuildingRequest());
142142
Properties properties = build.getProject().getProperties();
143-
String subdir = (String) properties.get( appSubdirectoryProperty );
143+
String subdir = (String) properties.get( APP_SUBDIRECTORY_PROPERTY );
144144

145145
installArtifact(result.getArtifact(), appDir, subdir, false, deleteOtherVersionsPolicy);
146146
}
@@ -152,7 +152,7 @@ public void execute() throws MojoExecutionException {
152152
catch ( ProjectBuildingException e )
153153
{
154154
throw new MojoExecutionException( "Couldn't determine " +
155-
appSubdirectoryProperty + " for " + result.getArtifact(), e );
155+
APP_SUBDIRECTORY_PROPERTY + " for " + result.getArtifact(), e );
156156
}
157157
}
158158
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
187187

188188
if (appDirectory == null) {
189189
throw new MojoExecutionException(
190-
"The '"+appDirectoryProperty+"' property is unset!");
190+
"The '"+APP_DIRECTORY_PROPERTY+"' property is unset!");
191191
}
192192
File appDir = new File(appDirectory);
193193
if (!appDir.isDirectory() && !appDir.mkdirs()) {
@@ -197,7 +197,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
197197

198198
if ( appSubdirectory == null )
199199
{
200-
getLog().info( "No property name for the " + appDirectoryProperty +
200+
getLog().info( "No property name for the " + APP_DIRECTORY_PROPERTY +
201201
" directory location was specified; Installing in default location" );
202202
}
203203

@@ -265,7 +265,7 @@ public boolean accept(Node node, List<Node> parents) {
265265
if (!ignoreDependencies) {
266266
ProjectBuildingResult build = mavenProjectBuilder.build(result.getArtifact(), session.getProjectBuildingRequest());
267267
Properties properties = build.getProject().getProperties();
268-
String subdir = (String) properties.get( appSubdirectoryProperty );
268+
String subdir = (String) properties.get( APP_SUBDIRECTORY_PROPERTY );
269269

270270
installArtifact(result.getArtifact(), appDir, subdir, false, deleteOtherVersionsPolicy);
271271
}
@@ -277,7 +277,7 @@ public boolean accept(Node node, List<Node> parents) {
277277
catch ( ProjectBuildingException e )
278278
{
279279
throw new MojoExecutionException( "Couldn't determine " +
280-
appSubdirectoryProperty + " for " + result.getArtifact(), e );
280+
APP_SUBDIRECTORY_PROPERTY + " for " + result.getArtifact(), e );
281281
}
282282
}
283283
}

0 commit comments

Comments
 (0)