22
22
import io .github .fvarrui .javapackager .packagers .ArtifactGenerator ;
23
23
import io .github .fvarrui .javapackager .packagers .Context ;
24
24
import io .github .fvarrui .javapackager .packagers .Packager ;
25
+ import io .github .fvarrui .javapackager .utils .FileUtils ;
25
26
import io .github .fvarrui .javapackager .utils .Logger ;
26
27
import io .github .fvarrui .javapackager .utils .MojoExecutorUtils ;
27
28
@@ -44,8 +45,8 @@ protected File doApply(Packager packager) {
44
45
File outputDirectory = packager .getOutputDirectory ();
45
46
ExecutionEnvironment env = Context .getMavenContext ().getEnv ();
46
47
Manifest manifest = packager .getManifest ();
47
-
48
- File jarFile = new File (outputDirectory , name + "-" + version + "-" + classifier + ".jar" );
48
+ String artifactId = env . getMavenProject (). getArtifactId ();
49
+ File jarFile = new File (outputDirectory , artifactId + "-" + classifier + ".jar" );
49
50
50
51
List <Element > archive = new ArrayList <>();
51
52
archive .add (
@@ -86,18 +87,21 @@ protected File doApply(Packager packager) {
86
87
configuration (
87
88
element ("classifier" , classifier ),
88
89
element ("archive" , archive .toArray (new Element [archive .size ()])),
89
- element ("outputDirectory" , jarFile . getParentFile () .getAbsolutePath ())
90
+ element ("outputDirectory" , outputDirectory .getAbsolutePath ())
90
91
),
91
- env );
92
-
92
+ env
93
+ );
94
+
93
95
} catch (MojoExecutionException e ) {
94
96
95
97
Logger .error ("Runnable jar creation failed! " + e .getMessage ());
96
98
throw new RuntimeException (e );
97
99
98
100
}
99
101
100
- return jarFile ;
102
+ File finalJarFile = new File (outputDirectory , name + "-" + version + "-" + classifier + ".jar" );
103
+ FileUtils .rename (jarFile , finalJarFile .getName ());
104
+ return finalJarFile ;
101
105
}
102
106
103
107
}
0 commit comments