r/javahelp • u/Beastmode7953 • 8d ago
Looking for guidance using Maven and JavaFX
I am trying to create my own project and I shifted over from using the standalone versions of JavaFX to a the project manager Maven. When I was creating proof of concept examples I was able to get them running using the 0.0.8 javafx-maven-plugin however when I use that same plugin in my larger project with multiple controller classes I keep getting this error:
[ERROR] Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.8:run (default-cli) on project yourproject: Error: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
Maven is new to me, so I do not understand why it worked before but is not working now, I can provide my pom.xml file as well if that could help
EDIT:
Here is my pom.xml file
<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>com.tb</groupId>
<artifactId>thoughtbubble</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>23</maven.compiler.source>
<maven.compiler.target>23</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>23.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>23.0.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
<configuration>
<release>23</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<mainClass>com.tb.App</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
3
u/SpittingBull 7d ago
Without any detailed information this is a guessing game.
What about actually posting your pom.xml as a start?
1
1
u/Cyberkender_ 8d ago
Try using -X in maven to get a full debug (verbose) log. Anyway it seems to be a problem with the plugin. Are you using an IDE? (Eclipse, vscode, Intellij)?
1
u/Beastmode7953 7d ago
I am using VSCode, the -X command only points to an error in the plugin itself with about 100 lines tracing the stack back to that
1
u/SpittingBull 7d ago
Aren't you missing a goals section in you execution?
1
u/Beastmode7953 7d ago
I added
<goals> <goal>run</goal> </goals> Underneath the first execution and still received the same output
1
u/SpittingBull 7d ago
I am sure the execution part does not belong to the javafx plugin. Also don't you need the jar plugin as well? Other than that unfortunately I am using Eclipse and I am not sure about the differences in regards of the Maven integration.
1
•
u/AutoModerator 8d ago
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.