Maven surefire and modular JavaFX 11
I have no problem running my project in the IDE or as a packaged jar, but somehow I always get this exception when running with surefire
java.lang.IllegalStateException: Location is not set.
javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2459)
javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
The project follows Maven's directory structure. The code I use to load the FXML is
Main.class.getClassLoader().getResource("fxml/App.fxml")
Does anyone have any idea what may be the issue? I've tried to google for similar problems but found none. I've also had no luck finding any working example projects that are similar to mine.
Edit 1: Here's the plugin declaration
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<threadCount>1</threadCount>
<printSummary>true</printSummary>
<skipTests>false</skipTests>
<systemPropertyVariables>
<glass.platform>Monocle</glass.platform>
<monocle.platform>Headless</monocle.platform>
<prism.order>d3d</prism.order>
</systemPropertyVariables>
<argLine>
--add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
java maven javafx maven-surefire-plugin javafx-11
|
show 1 more comment
I have no problem running my project in the IDE or as a packaged jar, but somehow I always get this exception when running with surefire
java.lang.IllegalStateException: Location is not set.
javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2459)
javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
The project follows Maven's directory structure. The code I use to load the FXML is
Main.class.getClassLoader().getResource("fxml/App.fxml")
Does anyone have any idea what may be the issue? I've tried to google for similar problems but found none. I've also had no luck finding any working example projects that are similar to mine.
Edit 1: Here's the plugin declaration
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<threadCount>1</threadCount>
<printSummary>true</printSummary>
<skipTests>false</skipTests>
<systemPropertyVariables>
<glass.platform>Monocle</glass.platform>
<monocle.platform>Headless</monocle.platform>
<prism.order>d3d</prism.order>
</systemPropertyVariables>
<argLine>
--add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
java maven javafx maven-surefire-plugin javafx-11
Can you provide a Minimal, Complete, and Verifiable example?
– Slaw
Nov 21 at 0:22
@Slaw I'm not sure how I would go about that, as I said everything about the project works fine except the maven surefire plugin, maybe I can add the plugin declaration to the question
– Gnas
Nov 21 at 0:31
I've made a quick test, and it works for me. Are you able to run your app (not the test)? Make sure the path to the FXML file is correct, or both run and test will fail. For instance, try with an absolute path:"/fxml/App.fxml".
– José Pereda
Nov 22 at 16:54
@JoséPereda Yes I can run the app (both in the IDE and as a packaged JAR), it's only the test that fails to run. Can you upload your code to github or somewhere so I can compare between yours and mine?
– Gnas
Nov 22 at 17:17
It will be better if you posted your code (even better, just a minimal complete and verifiable sample), so anyone can try to reproduce your issue.
– José Pereda
Nov 22 at 17:22
|
show 1 more comment
I have no problem running my project in the IDE or as a packaged jar, but somehow I always get this exception when running with surefire
java.lang.IllegalStateException: Location is not set.
javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2459)
javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
The project follows Maven's directory structure. The code I use to load the FXML is
Main.class.getClassLoader().getResource("fxml/App.fxml")
Does anyone have any idea what may be the issue? I've tried to google for similar problems but found none. I've also had no luck finding any working example projects that are similar to mine.
Edit 1: Here's the plugin declaration
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<threadCount>1</threadCount>
<printSummary>true</printSummary>
<skipTests>false</skipTests>
<systemPropertyVariables>
<glass.platform>Monocle</glass.platform>
<monocle.platform>Headless</monocle.platform>
<prism.order>d3d</prism.order>
</systemPropertyVariables>
<argLine>
--add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
java maven javafx maven-surefire-plugin javafx-11
I have no problem running my project in the IDE or as a packaged jar, but somehow I always get this exception when running with surefire
java.lang.IllegalStateException: Location is not set.
javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2459)
javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
The project follows Maven's directory structure. The code I use to load the FXML is
Main.class.getClassLoader().getResource("fxml/App.fxml")
Does anyone have any idea what may be the issue? I've tried to google for similar problems but found none. I've also had no luck finding any working example projects that are similar to mine.
Edit 1: Here's the plugin declaration
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<threadCount>1</threadCount>
<printSummary>true</printSummary>
<skipTests>false</skipTests>
<systemPropertyVariables>
<glass.platform>Monocle</glass.platform>
<monocle.platform>Headless</monocle.platform>
<prism.order>d3d</prism.order>
</systemPropertyVariables>
<argLine>
--add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
java maven javafx maven-surefire-plugin javafx-11
java maven javafx maven-surefire-plugin javafx-11
edited Nov 21 at 0:33
asked Nov 20 at 23:58
Gnas
49829
49829
Can you provide a Minimal, Complete, and Verifiable example?
– Slaw
Nov 21 at 0:22
@Slaw I'm not sure how I would go about that, as I said everything about the project works fine except the maven surefire plugin, maybe I can add the plugin declaration to the question
– Gnas
Nov 21 at 0:31
I've made a quick test, and it works for me. Are you able to run your app (not the test)? Make sure the path to the FXML file is correct, or both run and test will fail. For instance, try with an absolute path:"/fxml/App.fxml".
– José Pereda
Nov 22 at 16:54
@JoséPereda Yes I can run the app (both in the IDE and as a packaged JAR), it's only the test that fails to run. Can you upload your code to github or somewhere so I can compare between yours and mine?
– Gnas
Nov 22 at 17:17
It will be better if you posted your code (even better, just a minimal complete and verifiable sample), so anyone can try to reproduce your issue.
– José Pereda
Nov 22 at 17:22
|
show 1 more comment
Can you provide a Minimal, Complete, and Verifiable example?
– Slaw
Nov 21 at 0:22
@Slaw I'm not sure how I would go about that, as I said everything about the project works fine except the maven surefire plugin, maybe I can add the plugin declaration to the question
– Gnas
Nov 21 at 0:31
I've made a quick test, and it works for me. Are you able to run your app (not the test)? Make sure the path to the FXML file is correct, or both run and test will fail. For instance, try with an absolute path:"/fxml/App.fxml".
– José Pereda
Nov 22 at 16:54
@JoséPereda Yes I can run the app (both in the IDE and as a packaged JAR), it's only the test that fails to run. Can you upload your code to github or somewhere so I can compare between yours and mine?
– Gnas
Nov 22 at 17:17
It will be better if you posted your code (even better, just a minimal complete and verifiable sample), so anyone can try to reproduce your issue.
– José Pereda
Nov 22 at 17:22
Can you provide a Minimal, Complete, and Verifiable example?
– Slaw
Nov 21 at 0:22
Can you provide a Minimal, Complete, and Verifiable example?
– Slaw
Nov 21 at 0:22
@Slaw I'm not sure how I would go about that, as I said everything about the project works fine except the maven surefire plugin, maybe I can add the plugin declaration to the question
– Gnas
Nov 21 at 0:31
@Slaw I'm not sure how I would go about that, as I said everything about the project works fine except the maven surefire plugin, maybe I can add the plugin declaration to the question
– Gnas
Nov 21 at 0:31
I've made a quick test, and it works for me. Are you able to run your app (not the test)? Make sure the path to the FXML file is correct, or both run and test will fail. For instance, try with an absolute path:
"/fxml/App.fxml".– José Pereda
Nov 22 at 16:54
I've made a quick test, and it works for me. Are you able to run your app (not the test)? Make sure the path to the FXML file is correct, or both run and test will fail. For instance, try with an absolute path:
"/fxml/App.fxml".– José Pereda
Nov 22 at 16:54
@JoséPereda Yes I can run the app (both in the IDE and as a packaged JAR), it's only the test that fails to run. Can you upload your code to github or somewhere so I can compare between yours and mine?
– Gnas
Nov 22 at 17:17
@JoséPereda Yes I can run the app (both in the IDE and as a packaged JAR), it's only the test that fails to run. Can you upload your code to github or somewhere so I can compare between yours and mine?
– Gnas
Nov 22 at 17:17
It will be better if you posted your code (even better, just a minimal complete and verifiable sample), so anyone can try to reproduce your issue.
– José Pereda
Nov 22 at 17:22
It will be better if you posted your code (even better, just a minimal complete and verifiable sample), so anyone can try to reproduce your issue.
– José Pereda
Nov 22 at 17:22
|
show 1 more comment
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53403396%2fmaven-surefire-and-modular-javafx-11%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53403396%2fmaven-surefire-and-modular-javafx-11%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you provide a Minimal, Complete, and Verifiable example?
– Slaw
Nov 21 at 0:22
@Slaw I'm not sure how I would go about that, as I said everything about the project works fine except the maven surefire plugin, maybe I can add the plugin declaration to the question
– Gnas
Nov 21 at 0:31
I've made a quick test, and it works for me. Are you able to run your app (not the test)? Make sure the path to the FXML file is correct, or both run and test will fail. For instance, try with an absolute path:
"/fxml/App.fxml".– José Pereda
Nov 22 at 16:54
@JoséPereda Yes I can run the app (both in the IDE and as a packaged JAR), it's only the test that fails to run. Can you upload your code to github or somewhere so I can compare between yours and mine?
– Gnas
Nov 22 at 17:17
It will be better if you posted your code (even better, just a minimal complete and verifiable sample), so anyone can try to reproduce your issue.
– José Pereda
Nov 22 at 17:22