this is my Jboss-Deployment-Structure.xml file:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclude-subsystems>
<subsystem name="jaxrs" />
</exclude-subsystems>
<dependencies>
<!-- add our own modules -->
<module name="org.jboss.remoting3" />
<module name="deployment.ARXSecurityAPIToolkit.ear" export="true" />
<module name="df.properties" />
</dependencies>
<exclusions>
<!-- Exclude org.jboss.remoting3, we added custom module -->
<module name="org.jboss.remoting3" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Dependency deployment.ARXSecurityAPIToolkit.ear has several jars inside of it.
When creating a dependency, I want all jars in it except one(ARX.jar) to be a part of the dependency. How to exclude a particular jar(ARX.jar) from my ear in the dependency section.
Related
I am building a mobile gluon javafx application. App runs fine in the jvm but not on mobile.
I found out that i had ClassNotFoundException when loading the FXML and discovered that it would not find java.net.URL(!!) The unfound classes were not present in the projet arm64_ios reflection files, but i somewhat expected that as i did not directly use those classes in the code. Unfortunately, gluon seems not to be able to parse the fxml to add known classes. But i disgress.
Just to validate the problem, i added this class name to my POM reflectionList. As expected, it would find it but block on an other one, then an other one, this was endless.
I check out that when i ran gluonfx:runagent, the missing classes were correctly added to src/main/resources/META-INF/native-image/reflect-config.json.
As per https://docs.gluonhq.com/#_jni_and_reflection , i added a META-INF/substrate/congif/reflectionconfig.json file that was a copy of the META-INF/native-image/reflect-config.json. That did not help.
I do not know why the runagent files are not used, i think i might have fumbled somewhere. I will be very grateful for any hint. Thanks.
Here are the relevant parts of my POM.
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<javafx.version>17.0.2</javafx.version>
<attach.version>4.0.13</attach.version>
<gluonfx.plugin.version>1.0.12</gluonfx.plugin.version>
<javafx.plugin.version>0.0.8</javafx.plugin.version>
<mainClassName>com.blah</mainClassName>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>com.gluonhq</groupId>
<artifactId>charm-glisten</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>com.gluonhq.attach</groupId>
<artifactId>display</artifactId>
<version>${attach.version}</version>
</dependency>
<dependency>
<groupId>com.gluonhq.attach</groupId>
<artifactId>lifecycle</artifactId>
<version>${attach.version}</version>
</dependency>
<dependency>
<groupId>com.gluonhq.attach</groupId>
<artifactId>statusbar</artifactId>
<version>${attach.version}</version>
</dependency>
<dependency>
<groupId>com.gluonhq.attach</groupId>
<artifactId>storage</artifactId>
<version>${attach.version}</version>
</dependency>
<dependency>
<groupId>com.gluonhq.attach</groupId>
<artifactId>util</artifactId>
<version>${attach.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Gluon</id>
<url>https://nexus.gluonhq.com/nexus/content/repositories/releases</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>${javafx.plugin.version}</version>
<configuration>
<mainClass>${mainClassName}</mainClass>
</configuration>
<executions>
<execution>
<!-- Default configuration for running -->
<!-- Usage: mvn clean javafx:run -->
<id>default-cli</id>
</execution>
<execution>
<!-- Configuration for manual attach debugging -->
<!-- Usage: mvn clean javafx:run#debug -->
<id>debug</id>
<configuration>
<options>
<option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:8000</option>
</options>
</configuration>
</execution>
<execution>
<!-- Configuration for automatic IDE debugging -->
<id>ide-debug</id>
<configuration>
<options>
<option>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</option>
</options>
</configuration>
</execution>
<execution>
<!-- Configuration for automatic IDE profiling -->
<id>ide-profile</id>
<configuration>
<options>
<option>${profiler.jvmargs.arg1}</option>
<option>${profiler.jvmargs.arg2}</option>
<option>${profiler.jvmargs.arg3}</option>
<option>${profiler.jvmargs.arg4}</option>
<option>${profiler.jvmargs.arg5}</option>
</options>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.plugin.version}</version>
<configuration>
<verbose>true</verbose>
<target>${gluonfx.target}</target>
<attachList>
<list>display</list>
<list>lifecycle</list>
<list>statusbar</list>
<list>storage</list>
</attachList>
<reflectionList>
<list>java.net.URL</list>
</reflectionList>
<mainClass>${mainClassName}</mainClass>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.fxml</include>
<include>**/*.css</include>
<include>**/*.png</include>
<include>*.png</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.fxml</include>
<include>**/*.css</include>
<include>**/*.png</include>
<include>*.png</include>
</includes>
</resource>
</resources>
</build>
<profiles>
<profile>
<id>ios</id>
<properties>
<gluonfx.target>ios</gluonfx.target>
</properties>
</profile>
<profile>
<id>android</id>
<properties>
<gluonfx.target>android</gluonfx.target>
</properties>
</profile>
</profiles>
Ok, now i found a solution, not sure i understood what happens.
Everything was caused by my resources includes. Not sure why/if i added them, not sure where they came from. It seems that configuring includes removes the default ones and that forbid the inclusion of the json files, and thus i had no other defined reflections than those that were found at compilation.
Removing the includes section of the POM and adding <nativeImageArgs>--allow-incomplete-classpath</nativeImageArgs> within the POM finally cleared all compilation blurps.
This post helped me for this last tip: Why is my JavaFX 17 Application not building with Gluon ? Logged as JNI / Reflection problem
Thanks José for coming by.
We've been trying very hard for a while to build and push an image using fabric8, however no matter what we do to name the image, it is always named the same thing.
Building and deploying the image works fine, and we have it running on an OKD cluster. However no matter what we do the name is always the default
best-practice/best-practice-java:1.0.0
Rather than what we think we're specifying
internal/best-practice/best-practice-java:1.0.0
We run the following command
mvn clean package fabric8:build fabric8:push
This is the pom
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2016 Red Hat, Inc.
Red Hat licenses this file to you under the Apache License, version
2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>best-practice-java</artifactId>
<groupId>com.example.best-practice</groupId>
<version>1.0.0</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
</parent>
<properties>
<fabric8.mode>kubernetes</fabric8.mode>
<fabric8.build.strategy>docker</fabric8.build.strategy>
<docker.push.registry>artifactory.example.com</docker.push.registry>
<docker.registry>artifactory.example.com</docker.registry>
<docker.url>https://artifactory.example.com</docker.url>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.vlkan.log4j2</groupId>
<artifactId>log4j2-logstash-layout</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>4.2.0</version>
<configuration>
<generateRoute>true</generateRoute>
<images>
<image>
<name>{docker.push.registry}/internal/%g/%a:%v</name>
</image>
</images>
<enricher>
<config>
<fmp-controller>
<pullPolicy>Always</pullPolicy>
</fmp-controller>
<!-- Health check on the Spring Boot Actuator -->
<f8-healthcheck-spring-boot>
<timeoutSeconds>5</timeoutSeconds>
<readinessProbeInitialDelaySeconds>20</readinessProbeInitialDelaySeconds>
<failureThreshold>3</failureThreshold>
<successThreshold>1</successThreshold>
</f8-healthcheck-spring-boot>
</config>
</enricher>
</configuration>
</plugin>
</plugins>
</build>
</project>
I've been fighting with this for over a day and have read many posts on SO and other places, but I'm still having problems.
I need to include my application icon in a self-contained JavaFX application package. I'm using JDK 1.8.0_45 and its included JavaFX package. I'm using Maven to build the .exe and it all works great except I can't get my icon included.
Here is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<groupId>com.mycompany.drm</groupId>
<artifactId>DRMDashboard</artifactId>
<version>2.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javafx.version>8.0.45</javafx.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<!-- copy all dependencies of your app to target folder-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<configuration>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifestEntries>
<JavaFX-Version>${javafx.version}+</JavaFX-Version>
<Main-Class>com.mycompany.client.HelloWorld</Main-Class>
<implementation-version>2.0</implementation-version>
<JavaFX-Application-Class>com.mycompany.client.HelloWorld</JavaFX-Application-Class>
<JavaFX-Class-Path>
<!-- list all your dependencies here-->
</JavaFX-Class-Path>
<!-- The artifactId (name) of the jfxrt.jar ... see dependency system scope-->
<Class-Path>
javafx-${javafx.version}.jar
</Class-Path>
</manifestEntries>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<path id="mypath">
<pathelement path="${maven.plugin.classpath}"/>
<fileset dir="${project.basedir}">
<include name="package/windows/DRMDashboard.ico"/>
</fileset>
</path>
<!-- define the deploy ANT task-->
<taskdef name="jfxdeploy" classname="com.sun.javafx.tools.ant.DeployFXTask"
classpathref="mypath" />
<!-- define the JarSign ANT task-->
<taskdef name="jfxsignjar" classname="com.sun.javafx.tools.ant.FXSignJarTask"
classpathref="maven.plugin.classpath" />
<jfxdeploy outdir="${project.build.directory}/deploy"
outfile="DRMDashboard"
nativeBundles="exe"
verbose="true">
<info title="DRM Dashboard" vendor="My Company, Inc."/>
<application name="DRMDashboard" mainClass="com.mycompany.client.HelloWorld" version="2.0" />
<resources>
<fileset dir="${project.build.directory}" includes="*.jar" />
<!--includes="*.jar" />-->
</resources>
<!-- set your jvm args-->
<platform javafx="${javafx.version}+">
<jvmarg value="-Xms512m" />
<jvmarg value="-Xmx1024m" />
</platform>
<preferences install="false" menu="true" shortcut="true"/>
</jfxdeploy>
<!-- you need to generate a key yourself -->
<jfxsignjar destdir="${project.build.directory}/deploy"
keyStore="c:/Users/me/DRMDashboard.ks" storePass="****" alias="DRMDashboard"
keyPass="****">
<fileset dir="${project.build.directory}/deploy"
includes="*.jar" />
</jfxsignjar>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ant-javafx</artifactId>
<version>${javafx.version}</version>
<systemPath>${java.home}/../lib/ant-javafx.jar</systemPath>
<scope>system</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
<finalName>DRMDashboard</finalName>
</build>
</project>
EDIT 1: Here's a screenshot of my file explorer:
EDIT 2: Here's a screenshot of the expanded target folder:
When I execute the build with the verbose flag, I get these messages:
main:
No base JDK. Package will use system JRE.
Using default package resource [application icon] (add package/windows/DRMDashboard.ico to the class path to customize)
Icon File Name: C:\Users\jernst\AppData\Local\Temp\fxbundler8622978628378929412\windows\DRMDashboard.ico
Executable File Name: C:\Users\jernst\AppData\Local\Temp\fxbundler8622978628378929412\images\win-exe.image\DRMDashboard\DRMDashboard.exe
Config files are saved to C:\Users\jernst\AppData\Local\Temp\fxbundler8622978628378929412\windows. Use them to customize package.
Using default package resource [Inno Setup project file] (add package/windows/DRMDashboard.iss to the class path to customize)
Using default package resource [setup dialog icon] (add package/windows/DRMDashboard-setup-icon.bmp to the class path to customize)
Using default package resource [script to run after application image is populated] (add package/windows/DRMDashboard-post-image.wsf to the class path to customize)
I've tried using the "Drop In Resources" as described in the Oracle Documentation, but no matter what I try to get the classpath right, it won't recognize my custom icon
EDIT 3:
I used NwDx's suggested approach of using the javapackager instead of the ant task and I've gotten very close to what I need. Now my only problem is that the dialog box icon still uses the generic java coffee cup:
Here's my current POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<groupId>com.autoap.drm</groupId>
<artifactId>native_drm</artifactId>
<version>2.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javafx.version>8.0.45</javafx.version>
<mainClass>com.autoap.client.DRMDashboard</mainClass>
<application.title>DRMDashboard</application.title>
<organization.name>AutoAp, Inc.</organization.name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<!-- copy all dependencies of your app to target folder-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<configuration>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifestEntries>
<JavaFX-Version>${javafx.version}+</JavaFX-Version>
<Main-Class>com.autoap.client.DRMDashboard</Main-Class>
<implementation-version>2.0</implementation-version>
<JavaFX-Application-Class>com.autoap.client.DRMDashboard</JavaFX-Application-Class>
<JavaFX-Class-Path>
<!-- list all your dependencies here-->
</JavaFX-Class-Path>
<!-- The artifactId (name) of the jfxrt.jar ... see dependency system scope-->
<Class-Path>
javafx-${javafx.version}.jar
</Class-Path>
</manifestEntries>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<!-- Create the jar file -->
<execution>
<id>createjar</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/../bin/javapackager</executable>
<arguments>
<argument>-createjar</argument>
<argument>-nocss2bin</argument>
<argument>-appclass</argument>
<argument>${mainClass}</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}/classes</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}</argument>
<argument>-outfile</argument>
<argument>${project.build.finalName}.jar</argument>
</arguments>
</configuration>
</execution>
<!-- Sign the jar -->
<!-- Can't test, because I don't have the files
<execution>
<id>signjar</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/../bin/javapackager</executable>
<arguments>
<argument>-signjar</argument>
<argument>-alias</argument>
<argument>${application.title}</argument>
<argument>-keyPass</argument>
<argument>****</argument>
<argument>-keyStore</argument>
<argument>C:/Users/me/DRMDashboard.ks</argument>
<argument>-storePass</argument>
<argument>*****</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}</argument>
<argument>-srcfiles</argument>
<argument>${project.build.finalName}.jar</argument>
</arguments>
</configuration>
</execution> -->
<!-- Deploy a native version -->
<execution>
<id>deploy</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/../bin/javapackager</executable>
<arguments>
<argument>-deploy</argument>
<argument>-appclass</argument>
<argument>${mainClass}</argument>
<argument>-native</argument>
<argument>exe</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}</argument>
<argument>-srcfiles</argument>
<argument>${project.build.finalName}.jar</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}/dist</argument>
<argument>-outfile</argument>
<argument>${project.build.finalName}</argument>
<argument>-Bicon=${project.build.directory}/classes/${application.title}.ico</argument>
<argument>-BappVersion=${project.version}</argument>
<argument>-Bcopyright='2015 AutoAp, Inc.'</argument>
<argument>-BshortcutHint=true</argument>
<argument>-BsystemWide=false</argument>
<argument>-Bwin.menuGroup=${organization.name}</argument>
<argument>-Bvendor=${organization.name}</argument>
<argument>-v</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<commandlineArgs>-jar '${project.build.directory}/${project.build.finalName}.jar'</commandlineArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<finalName>DRMDashboard</finalName>
</build>
</project>
The thing that made the icon show up in the title bar is the -Bicon=${project.build.directory}/classes/${application.title}.ico argument to the javapackager deploy step. That line tells the inno installer to use the icon. The last piece of the puzzle is how to make inno use the bmp for the dialog box image. Here's the relevant bit of the log file:
Running [C:\Program Files\Java\jdk1.8.0_45\jre\bin\java, -version]
Running [C:\Program Files (x86)\Inno Setup 5\iscc.exe, /?]
Detected [C:\Program Files (x86)\Inno Setup 5\iscc.exe] version [5]
Using custom package resource [application icon] (loaded from file C:\Users\jernst\IdeaProjects\AutoAp\native_drm\target\classes\DRMDashboard.ico)
Running [C:\Users\jernst\AppData\Local\Temp\iconswap106251599206027586.exe, C:\Users\jernst\AppData\Local\Temp\fxbundler6949394438624826643\windows\DRMDashboard.ico, C:\Users\jernst\AppData\Local\Temp\fxbundler6949394438624826643\images\win-exe.image\DRMDashboard\DRMDashboard.exe]
Icon File Name: C:\Users\jernst\AppData\Local\Temp\fxbundler6949394438624826643\windows\DRMDashboard.ico
Executable File Name: C:\Users\jernst\AppData\Local\Temp\fxbundler6949394438624826643\images\win-exe.image\DRMDashboard\DRMDashboard.exe
Config files are saved to C:\Users\jernst\AppData\Local\Temp\fxbundler6949394438624826643\windows. Use them to customize package.
Using default package resource [Inno Setup project file] (add package/windows/DRMDashboard.iss to the class path to customize)
Using default package resource [setup dialog icon] (add package/windows/DRMDashboard-setup-icon.bmp to the class path to customize)
Using default package resource [script to run after application image is populated] (add package/windows/DRMDashboard-post-image.wsf to the class path to customize)
Generating EXE for installer to: C:\Users\jernst\IdeaProjects\AutoAp\native_drm\target\dist\bundles
Running [C:\Program Files (x86)\Inno Setup 5\iscc.exe, /oC:\Users\jernst\IdeaProjects\AutoAp\native_drm\target\dist\bundles, C:\Users\jernst\AppData\Local\Temp\fxbundler6949394438624826643\images\win-exe.image\DRMDashboard.iss] in C:\Users\jernst\AppData\Local\Temp\fxbundler6949394438624826643\images\win-exe.image
Inno Setup 5 Command-Line Compiler
You can see where it finds my custom application icon, but it's not finding the custom setup dialog icon.
Prerequirements / Assumptions
You're on Windows (7, 8, 8.1)
You have a JDK installed at least in version 1.8.0 (javafx included)
You've set the JAVA_HOME environment variable pointing to the top directory of your JDK (ex. C:\Program Files\Java\jdk1.8.0_45)
You have Inno Setup at least in version 5.5.5 installed (prefered the unicode version)
You already have a icon file (256 x 256px), prefered a multisize one. I recommend to visit this site: http://icoconvert.com/
You already have a bmp file (48 x 48 px) for the setup installer as setup icon
Solution
Project structure
First you need to setup the Project in a valid structure, like this:
Your package folder have to be in the project root folder and not in any subfolder like src or resources.
pom.xml
There are some more properties needed for doing the correct deploy. As you can see in the antrun plugin section, you need to reassign the properties for your ant environment before you can call the build file. The properties are automatically set to the called build file. Normaly Intellij Idea will create the pom.xml for you in the project root dir.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.autoap</groupId>
<artifactId>HelloWorld</artifactId>
<version>2.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>com.autoap.client.HelloWorld</mainClass>
<application.title>${project.artifactId}</application.title>
<copyright>Han Solo</copyright>
</properties>
<organization>
<name>Star Wars</name>
</organization>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludeScope>system</excludeScope>
<excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<commandlineArgs>-jar '${project.build.directory}/dist/${project.build.finalName}-${project.version}.jar'
</commandlineArgs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<property name="compile_classpath" refid="maven.compile.classpath"/>
<property name="outputDir" value="${project.build.outputDirectory}"/>
<property name="sourceDir" value="${project.build.sourceDirectory}"/>
<property name="distDir" value="${project.build.outputDirectory}/../dist"/>
<property name="javaHome" value="${java.home}"/>
<property name="versionNo" value="${project.version}"/>
<property name="mainClass" value="${mainClass}" />
<property name="appName" value="${application.title}"/>
<property name="appTitle" value="${application.title}"/>
<property name="appVendor" value="${project.organization.name}"/>
<property name="appCopyright" value="${copyright}"/>
<property name="appMenuGroup" value="${project.organization.name}"/>
<ant antfile="${basedir}/build.xml" target="default"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
build.xml
I've tried to make it loosley coupled, so there is normaly no need to change anything in that file. Only if you want to have signing or special behaviour etc.The build.xml file should be saved in the project root dir.
<?xml version="1.0" encoding="UTF-8" ?>
<project name="App" default="default" basedir="."
xmlns:fx="javafx:com.sun.javafx.tools.ant">
<target name="default" depends="clean,compile">
<!-- defines the classpath -->
<path id="cp">
<filelist>
<file name="${javaHome}/../lib/ant-javafx.jar"/>
<file name="${basedir}" />
</filelist>
</path>
<!-- defines the task with a reference to classpath -->
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
uri="javafx:com.sun.javafx.tools.ant"
classpathref="cp"/>
<fx:application id="appId"
name="${appName}"
mainClass="${mainClass}"
version="${versionNo}"/>
<!-- Defines the resources needed by the application -->
<fx:resources id="appRes">
<fx:fileset dir="${distDir}" includes="${appName}-${versionNo}.jar"/>
</fx:resources>
<!-- Create a jar file -->
<fx:jar destfile="${distDir}/${appName}-${versionNo}.jar">
<fx:application refid="appId"/>
<fx:resources refid="appRes"/>
<fileset dir="${outputDir}"/>
</fx:jar>
<fx:deploy width="300" height="250"
outdir="${distDir}" embedJNLP="true"
outfile="${appName}-${versionNo}"
nativebundles="exe" verbose="true">
<!-- define for ex. min javafx version -->
<!-- <fx:platform /> -->
<!-- defines the application and setup preferences -->
<fx:preferences shortcut="true" install="true" menu="true"/>
<!-- defines the application parts -->
<fx:application refId="appId"/>
<!-- defines the needed resources -->
<fx:resources refid="appRes"/>
<!-- defines the application info details -->
<fx:info title="${appTitle}"
vendor="${appVendor}"
copyright="${appCopyright}"/>
<!-- Some bundle arguments only for special platforms -->
<fx:bundleArgument arg="win.menuGroup" value="${appMenuGroup}"/>
</fx:deploy>
</target>
<!-- Removes the folders of previous runs -->
<target name="clean">
<mkdir dir="${outputDir}"/>
<mkdir dir="${distDir}"/>
<delete>
<fileset dir="${outputDir}" includes="**/*"/>
<fileset dir="${distDir}" includes="**/*"/>
</delete>
</target>
<!-- Compiles the sources -->
<target name="compile" depends="clean">
<javac includeantruntime="false"
srcdir="${sourceDir}"
destdir="${outputDir}"
fork="yes"
executable="${javaHome}/../bin/javac"
source="1.8"
debug="on">
</javac>
</target>
</project>
Images in package folder
The images in your package folder need to be renamed. The icon file need to be exactly (case-sensitive) named as the property application.title in your maven pom. The second file is the setup icon, it need the exact application title as first part and -setup-icon.bmp the last part. It needs to be a bmp. Sizes mentioned above.
My images looks like that:
Run configuration
The only thing you now need is to run the scripts to deploy it. For this you need a special run configuration like showing in the next screen:
App
After you have configured the run, run it and you will get the app. My App is nothing special only the default Hello World example and it looks like that:
Path to exe installer
In your project root is a folder target->dist->bundles, there you get your new Setup.exe
Installer with icon
Finally you got it.
Target structure
The target folder contains a non valid jar from the maven run, but it doesn't matter. You only should know, that if you only want the jar to start by double click, you need to choose the one in the dist folder. The jar in the dist folder is essential, because the whole process of creating an installer relies on this jar. Now you be also able to put a *.iss file in your package windows folder to customize more parts of the creation process, like a license file etc. For doing this, have a look here at the documention of Inno Setup.
For folks who are already using Maven to build a jar, building a native app and including an icon is easy with the javafx-maven-plugin. (I found it via this answer.)
The plugin developers have provided a nice little auto-configuration script. I had to add a <vendor> key, but then everything worked smoothly.
Once you have that working, all you have to do to get a custom icon is create a correctly-formatted file, give it exactly the same name as the native app, and drop it in the correct folder for the given system:
Windows: put some ICO-file at src/main/deploy/package/windows/{appname}.ico, where {appname} is the configured appname of your application
Mac OS(X): put some ICNS-file at src/main/deploy/package/macosx/{appname}.icns, where {appname} is the configured appname of your application
Linux: put some PNG-file at src/main/deploy/package/linux/{appname}.png, where {appname} is the configured appname of your application
(The text above was copied from this issue.)
I've tested this on both Windows and Mac, and it works in both cases.
Have you considered using launch4j? I have used it to create my exe files and it works flawlessly and allows you to set the icon. I use it coupled with izpack.
you neeed put the package folder in your root project. The output from console indicate the correct path. I know this Is old question but can help someone else.
I am having issues getting maven to do a simple clean install I am getting the following error:
Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:3.8:compile-swf (default-compile-swf) on project flex: Source file not expecified and no default found! -> [Help 1]
I was following the tutorial on this site: Adobe Developer Connection - Flex and Maven
I have all of my .as files located in: src/main/flex/ but the problem is that I don't have a Main class, these are all basically interfaces so I can't just choose one of them to be the source file.
I have Eclipse installed as well, and it is yelling at me for the plugin part of the POM, saying:
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.sonatype.flexmojos:flexmojos-maven-plugin:
3.8:compile-swf (execution: default-compile-swf, phase: compile)
- Plugin execution not covered by lifecycle configuration: org.sonatype.flexmojos:flexmojos-maven-plugin:
3.8:test-compile (execution: default-test-compile, phase: test-compile)
So I am not sure if this is related or not, but I have tried to copy/paste the code from the link above verbatim but I still get that error and the guy never mentions anything about it, so perhaps it's just a bug in the maven plugin in Eclipse.
Here is my POM.xml file:
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.company</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>flex</artifactId>
<name>flex</name>
<packaging>swf</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.company</groupId>
<artifactId>common</artifactId>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>flex-framework</artifactId>
<version>3.6.0.16995</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/flex</sourceDirectory>
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<version>3.6.0.16995</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
I am open to ANY ideas on how to get this to compile these .as files. Thank you!
Edit: Okay I figured it out. I changed the packaging from swf to swc and it works. So very sad.
I converted the package from swf to swc and it worked like a champ. Hopefully this helps someone in the future.
you need the configuration tag so flexmojos knows where to start the build. (default application, or main class)
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<configuration>
<sourceFile>Module.mxml</sourceFile>
</configuration>
<version>3.6.0.16995</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
There is a maven based project, which can be built by maven install, but throw exception when run the out jar:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/CommandLineParser
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.CommandLineParser
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
I want to know why java can not find the maven dependency library ?
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.artofsolving.jodconverter</groupId>
<artifactId>jodconverter-core</artifactId>
<version>3.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JODConverter - Core Library</name>
<description>
JODConverter converts office documents using OpenOffice.org
</description>
<url>http://jodconverter.googlecode.com</url>
<licenses>
<license>
<name>GNU Lesser General Public License, Version 3 or later</name>
<url>http://www.gnu.org/licenses/lgpl.html</url>
</license>
</licenses>
<scm>
<url>http://jodconverter.googlecode.com/svn/trunk/jodconverter-core</url>
<connection>scm:svn:https://jodconverter.googlecode.com/svn/trunk/jodconverter-core/</connection>
</scm>
<inceptionYear>2003</inceptionYear>
<developers>
<developer>
<id>mirko.nasato</id>
<name>Mirko Nasato</name>
<email>mirko#artofsolving.com</email>
</developer>
</developers>
<contributors>
<contributor>
<name>Shervin Asgari</name>
<email>shervin#asgari.no</email>
</contributor>
</contributors>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<!-- required for org.hyperic:sigar -->
<id>jboss-public-repository-group</id>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
</repository>
</repositories>
<dependencies>
<!-- Required dependencies -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.openoffice</groupId>
<artifactId>juh</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>org.openoffice</groupId>
<artifactId>ridl</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>org.openoffice</groupId>
<artifactId>unoil</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<!-- for the command line tool -->
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<!-- Optional dependencies -->
<dependency>
<!-- for more robust process management -->
<groupId>org.hyperic</groupId>
<artifactId>sigar</artifactId>
<version>1.6.5.132</version>
<optional>true</optional>
</dependency>
<dependency>
<!-- for JSON configuration -->
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
<optional>true</optional>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<configuration>
<!-- don't run tests in parallel -->
<perCoreThreadCount>false</perCoreThreadCount>
<threadCount>1</threadCount>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<manifest>
<mainClass>org.artofsolving.jodconverter.cli.Convert</mainClass>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/dist.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</reporting>
</project>
When running your Jar with java -jar, you're no longer running with the maven resolving of dependencies. You have to make sure that all the jars you depend on are available at the relative loacation specificied in the MANIFEST.mf file in your Jar. Usually, you would use the assembly plugin to create a distributable archive that creates this structure. Or you could use a uberjar/onejar plugin to included everything inside your Jar.
You have 2 options to fix this:
Option 1 - use both plugins below to copy dependencies to a "lib" folder (see outputDirectory) and make your Runnable JAR know where they are (see classpathPrefix)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>example.MyMainClass</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
Option 2 - Use maven-assembly-plugin to create a single JAR with all dependencies included. (all dependencies are extracted and compressed together in the same JAR)
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>compile</scope>
</dependencySet>
</dependencySets>
I've seen the problem, too. Cobertura creates instrumented copies of all compiled classfiles (in target/classes) by bytecode manipulation. My jar file contained the instrumented class files (from target/generated-classes/cobertura), but cobertura.jar was missing. So, ClassNotFoundException was the right reaction.
However, since my POM doesn't contain any hint, which are the intended classes for packaging, Maven has the free choice ... and it uses the instrumented set of files.
My solution was really simple: mvn clean and mvn package. The first call removes all instrumented classes. Then, the second call finds only the uninstrumented classes without any external references to Cobertura.