My pom.xml is
<?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.spt</groupId>
<artifactId>astra</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>javafx</groupId>
<artifactId>javafx</artifactId>
<version>2.2.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/jfxrt.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.spt.buket_3_wifi.desktop.Main</mainClass>sta
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>default-copy-resources</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.7</version>
<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>
</plugin>
</plugins>
</build>
</project>
It compiles successfully, both dependencies log4j-1.2.17.jar and javafx-2.2.3.jar are copied to lib folder. The problem is that lib/javafx-2.2.3.jar doesn't included in Class-Path in jar manifest file, so I unable to run it. MANIFEST.MF is:
Manifest-Version: 1.0
Built-By: karasev
Build-Jdk: 1.7.0_40
Class-Path: lib/log4j-1.2.17.jar
Created-By: Apache Maven 3.1.0
Main-Class: com.spt.buket_3_wifi.desktop.Main
Archiver-Version: Plexus Archiver
As you can see, only lib/log4j-1.2.17.jar is added. What's the problem? Any ideas?
You may try this approach:
...[truncated]...
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.spt.buket_3_wifi.desktop.Main</mainClass>
</manifest>
<manifestEntries>
<Class-Path>lib/javafx-2.2.3.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
...[truncated]...
But this is not necessary for JavaFX library as it's already in JVM classpath.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With