@@ -196,16 +196,17 @@ protected File getJarFile( File basedir, String resultFinalName, String classifi
196
196
throw new IllegalArgumentException ( "finalName is not allowed to be null" );
197
197
}
198
198
199
- StringBuilder fileName = new StringBuilder ( resultFinalName );
200
-
199
+ String fileName ;
201
200
if ( hasClassifier () )
202
201
{
203
- fileName .append ( "-" ).append ( classifier );
202
+ fileName = resultFinalName + "-" + classifier + ".jar" ;
203
+ }
204
+ else
205
+ {
206
+ fileName = resultFinalName + ".jar" ;
204
207
}
205
208
206
- fileName .append ( ".jar" );
207
-
208
- return new File ( basedir , fileName .toString () );
209
+ return new File ( basedir , fileName );
209
210
}
210
211
211
212
/**
@@ -243,18 +244,11 @@ public File createArchive()
243
244
}
244
245
}
245
246
247
+ String archiverName = containsModuleDescriptor ? "mjar" : "jar" ;
248
+
246
249
MavenArchiver archiver = new MavenArchiver ();
247
250
archiver .setCreatedBy ( "Maven JAR Plugin" , "org.apache.maven.plugins" , "maven-jar-plugin" );
248
-
249
- if ( containsModuleDescriptor )
250
- {
251
- archiver .setArchiver ( (JarArchiver ) archivers .get ( "mjar" ) );
252
- }
253
- else
254
- {
255
- archiver .setArchiver ( (JarArchiver ) archivers .get ( "jar" ) );
256
- }
257
-
251
+ archiver .setArchiver ( (JarArchiver ) archivers .get ( archiverName ) );
258
252
archiver .setOutputFile ( jarFile );
259
253
260
254
// configure for Reproducible Builds based on outputTimestamp value
@@ -328,28 +322,20 @@ public void execute()
328
322
329
323
private boolean projectHasAlreadySetAnArtifact ()
330
324
{
331
- if ( getProject ().getArtifact ().getFile () != null )
332
- {
333
- return getProject ().getArtifact ().getFile ().isFile ();
334
- }
335
- else
325
+ if ( getProject ().getArtifact ().getFile () == null )
336
326
{
337
327
return false ;
338
328
}
329
+
330
+ return getProject ().getArtifact ().getFile ().isFile ();
339
331
}
340
332
341
333
/**
342
334
* @return true in case where the classifier is not {@code null} and contains something else than white spaces.
343
335
*/
344
336
protected boolean hasClassifier ()
345
337
{
346
- boolean result = false ;
347
- if ( getClassifier () != null && getClassifier ().trim ().length () > 0 )
348
- {
349
- result = true ;
350
- }
351
-
352
- return result ;
338
+ return getClassifier () != null && getClassifier ().trim ().length () > 0 ;
353
339
}
354
340
355
341
private String [] getIncludes ()
0 commit comments