File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
src/main/java/fvarrui/maven/plugin/javapackager Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -274,7 +274,8 @@ private void generateRpmPackage() throws MojoExecutionException {
274
274
275
275
// rename generated rpm package
276
276
File rpmFile = new File (assetsFolder , name + "-" + version + "-2.x86_64.rpm" );
277
- rpmFile .renameTo (new File (assetsFolder , name + "_" + version + ".rpm" ));
277
+ String newName = name + "_" + version + ".rpm" ;
278
+ FileUtils .rename (rpmFile , newName );
278
279
279
280
}
280
281
Original file line number Diff line number Diff line change 17
17
18
18
import org .apache .commons .io .IOUtils ;
19
19
import org .apache .commons .lang .StringUtils ;
20
+ import org .apache .commons .lang .SystemUtils ;
20
21
import org .apache .maven .plugin .MojoExecutionException ;
21
22
22
23
@@ -149,5 +150,17 @@ public static void removeFolder(File folder) throws MojoExecutionException {
149
150
throw new MojoExecutionException ("Could not remove folder " + folder , e );
150
151
}
151
152
}
153
+
154
+ public static void rename (File file , String newName ) throws MojoExecutionException {
155
+ Logger .info ("Changing name of [" + file + "] to [" + newName + "]" );
156
+ try {
157
+ if (SystemUtils .IS_OS_LINUX )
158
+ ProcessUtils .execute ("mv" , file , newName );
159
+ else
160
+ file .renameTo (new File (newName )); // FIXME this doesn't work on linux, I don't know why
161
+ } catch (MojoExecutionException e ) {
162
+ throw new MojoExecutionException ("File [" + file + "] couldn't be renamed to [" + newName + "]" , e );
163
+ }
164
+ }
152
165
153
166
}
You can’t perform that action at this time.
0 commit comments