Skip to content

Commit d578908

Browse files
committed
A default xpm icon file
1 parent b5b4206 commit d578908

File tree

3 files changed

+254
-7
lines changed

3 files changed

+254
-7
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ And by default it will generate next artifacts in `target ` folder:
6464
| `${name}` | Directory with the native application and other needed assets. |
6565
| `${name}-${version}-runnable.jar` | Runnable JAR file. |
6666
| `${name}_${version}.deb` | DEB package file if it's executed on GNU/Linux (requires **dpkg-deb**). |
67-
| `${name}_${version}.rpm` | RPM package file if it's executed on GNU/Linux (requires **alien** & **rpmbuild**). |
67+
| `${name}_${version}.rpm` | RPM package file if it's executed on GNU/Linux (requires **rpm-build**). |
6868
| `${name}_${version}.exe` | Installer file if it's executed on Windows (requires [**Inno Setup**](http://www.jrsoftware.org/isinfo.php)). |
6969
| `${name}_${version}.dmg` | Disk image file if it's executed on Mac OS X (requires **hdiutil**). |
7070
| `${name}-${version}-bundle.zip` | Zipball containing generated directory `${name}` if `createZipball` property is `true`. |
@@ -89,7 +89,7 @@ And by default it will generate next artifacts in `target ` folder:
8989
| `displayName` | :x: | `${project.name}` or `${name}` | App name to show. |
9090
| `envPath` | :x: | `null` | Defines PATH environment variable in GNU/Linux and Mac OS X startup scripts. |
9191
| `generateInstaller` | :x: | `true` | Generates an installer for the app. |
92-
| `iconFile` | :x: | `null` | Path to the app icon file (PNG, ICO or ICNS). |
92+
| `iconFile` | :x: | `null` | Path to the app icon file (PNG, XPM, ICO or ICNS). |
9393
| `jreDirectoryName` | :x: | `"jre"` | Bundled JRE directory name. |
9494
| `jrePath` | :x: | `""` | Path to JRE folder. If specified, it will bundle this JRE with the app, and won't generate a customized JRE. For Java 8 version or least. |
9595
| `licenseFile` | :x: | `${project.licenses[0].url}` or `${project.basedir}/LICENSE` | Path to project license file. |
@@ -148,11 +148,12 @@ If icons are located in `assets` folders, it would not be necessary to specify t
148148
<project>/
149149
└── assets/
150150
├── linux/
151-
│   └── ${name}.png # on GNU/Linux it has to be a png image
151+
│   ├── ${name}.png # on GNU/Linux it has to be a PNG file for DEB package
152+
│   └── ${name}.xpm # and XPM file for RPM package
152153
├── mac/
153-
│   └── ${name}.icns # on Mac OS X it has to be a icns file
154+
│   └── ${name}.icns # on Mac OS X it has to be a ICNS file
154155
└── windows/
155-
└── ${name}.ico # on Windows it has to be a ico file
156+
└── ${name}.ico # on Windows it has to be a ICO file
156157
```
157158

158159
> :warning: If `iconFile` plugin property is not specified and it can't find the correct icon in `assets` folder, it will use an [icon by default](https://raw.githubusercontent.com/fvarrui/JavaPackager/master/src/main/resources/linux/default-icon.png) for all platforms.

src/main/java/io/github/fvarrui/javapackager/PackageMojo.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.Map;
1919
import java.util.stream.Collectors;
2020

21+
import org.apache.commons.io.FilenameUtils;
2122
import org.apache.commons.lang3.StringUtils;
2223
import org.apache.commons.lang3.SystemUtils;
2324
import org.apache.maven.execution.MavenSession;
@@ -495,19 +496,24 @@ private void generateRpmPackage() throws MojoExecutionException {
495496
// String newName = name + "_" + version + ".rpm";
496497
// FileUtils.rename(rpmFile, newName);
497498

499+
File xpmIcon = new File(iconFile.getParentFile(), FilenameUtils.removeExtension(iconFile.getName()) + ".xpm");
500+
if (!xpmIcon.exists()) {
501+
FileUtils.copyResourceToFile("/linux/default-icon.xpm", xpmIcon);
502+
}
503+
498504
// invokes plugin to generate deb package
499505
executeMojo(
500506
plugin(
501507
groupId("org.codehaus.mojo"),
502508
artifactId("rpm-maven-plugin"),
503509
version("2.2.0")
504-
),
510+
),
505511
goal("rpm"),
506512
configuration(
507513
element("license", mavenProject.getLicenses() != null && !mavenProject.getLicenses().isEmpty() && mavenProject.getLicenses().get(0) != null ? mavenProject.getLicenses().get(0).getName() : ""),
508514
element("packager", organizationName),
509515
element("group", "Application"),
510-
element("icon", iconFile.getAbsolutePath()),
516+
element("icon", xpmIcon.getAbsolutePath()),
511517
element("needarch", "true"),
512518
element("mappings",
513519
/* app folder files, except executable file and jre/bin/java */

0 commit comments

Comments
 (0)