4545
4646@ Mojo (name = "package" , defaultPhase = LifecyclePhase .PACKAGE , requiresDependencyResolution = ResolutionScope .RUNTIME )
4747public class PackageMojo extends AbstractMojo {
48+
49+ private static final String DEFAULT_ORGANIZATION_NAME = "ACME" ;
4850
4951 // maven components
5052
@@ -273,7 +275,7 @@ public void execute() throws MojoExecutionException {
273275 description = defaultIfBlank (description , displayName );
274276
275277 // using "ACME" as organizationName, if it's not specified
276- organizationName = defaultIfBlank (organizationName , "ACME" );
278+ organizationName = defaultIfBlank (organizationName , DEFAULT_ORGANIZATION_NAME );
277279
278280 // determines current platform
279281 hostPlatform = getCurrentPlatform ();
@@ -310,7 +312,7 @@ public void execute() throws MojoExecutionException {
310312
311313 // creates a runnable jar file
312314 if (runnableJar == null || runnableJar .isBlank ()) {
313- createRunnableJar ();
315+ jarFile = createRunnableJar (name , version , mavenProject . getPackaging () );
314316 } else {
315317 getLog ().info ("Using runnable JAR: " + runnableJar );
316318 jarFile = new File (runnableJar );
@@ -393,12 +395,12 @@ private void resolveIcon() throws MojoExecutionException {
393395 *
394396 * @throws MojoExecutionException
395397 */
396- private void createRunnableJar () throws MojoExecutionException {
398+ private File createRunnableJar (String name , String version , String packaging ) throws MojoExecutionException {
397399 getLog ().info ("Creating runnable JAR..." );
398400
399401 String classifier = "runnable" ;
400402
401- jarFile = new File (outputDirectory , name + "-" + version + "-" + classifier + "." + mavenProject . getPackaging () );
403+ File jarFile = new File (outputDirectory , name + "-" + version + "-" + classifier + "." + packaging );
402404
403405 executeMojo (
404406 plugin (
@@ -420,6 +422,8 @@ private void createRunnableJar() throws MojoExecutionException {
420422 element ("finalName" , name + "-" + version )
421423 ),
422424 env );
425+
426+ return jarFile ;
423427 }
424428
425429 /**
0 commit comments