Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add compile time dependencies for Java 9+ #151

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,52 @@
</plugins>
</build>

<profiles>
<!-- Java 9/10: java.xml.bind is needed -->
<profile>
<id>Java9</id>
<activation>
<jdk>[9,10]</jdk>
</activation>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
</profile>
<!-- Java 11+: java.xml.bind and JavaFX -->
<profile>
<id>Java11+</id>
<activation>
<jdk>![1.8,9,10]</jdk>
</activation>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>11.0.2</version>
</dependency>
</dependencies>
</profile>
</profiles>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
32 changes: 15 additions & 17 deletions src/main/java/fxlauncher/Launcher.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
package fxlauncher;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URI;
import java.nio.file.Path;
import java.util.Iterator;
import java.util.ServiceLoader;
import java.util.concurrent.CountDownLatch;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.sun.javafx.application.ParametersImpl;
import com.sun.javafx.application.PlatformImpl;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
Expand All @@ -13,18 +26,6 @@
import javafx.stage.Stage;
import javafx.stage.StageStyle;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URI;
import java.nio.file.Path;
import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.concurrent.CountDownLatch;

@SuppressWarnings("unchecked")
public class Launcher extends Application {
private static final Logger log = Logger.getLogger("Launcher");
Expand All @@ -35,7 +36,7 @@ public class Launcher extends Application {
private UIProvider uiProvider;
private StackPane root;

private final AbstractLauncher superLauncher = new AbstractLauncher<Application>() {
private final AbstractLauncher<Application> superLauncher = new AbstractLauncher<Application>() {
@Override
protected Parameters getParameters() {
return Launcher.this.getParameters();
Expand Down Expand Up @@ -236,10 +237,7 @@ private void initApplication() throws Exception {

private void startApplication() throws Exception {
if (app != null) {
final LauncherParams params = new LauncherParams(getParameters(), superLauncher.getManifest());
app.getParameters().getNamed().putAll(params.getNamed());
app.getParameters().getRaw().addAll(params.getRaw());
app.getParameters().getUnnamed().addAll(params.getUnnamed());
ParametersImpl.registerParameters(app, new LauncherParams(getParameters(), superLauncher.getManifest()));

PlatformImpl.setApplicationName(app.getClass());
superLauncher.setPhase("Application Init");
Expand Down