An example of a transition to Maven (the entire transition is a slight change in the directory structure).
Normal JavaFX project:

Close the environment, go to the explorer (you can also through the environment, but it automatically changes the specified packages in the classes. And so that you do not fix them back, it is easier to do through the explorer).
Missing directories to create:
- src / main / java - Source directory. Required. In the java folder, completely transfer the org folder (except fxml).
- src / main / resources - Directory of resources. In general, it is not required, but when javaFX it is customary to store fxml, css, image and other files in it. In the resources folder, transfer the fxml folder.
- src / test / java - Test source directory. Not required.
- src / test / resources - Test resource directory. Not required.
Put pom.xml in the Project folder
<?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>org.company</groupId> <artifactId>project</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>Project</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <mainClass>org.company.Main</mainClass> </properties> <dependencies> <!-- Сюда вставлять зависимости --> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <executions> <execution> <id>unpack-dependencies</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> <execution> <id>default-cli</id> <goals> <goal>exec</goal> </goals> </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> <compilerArguments> <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath> </compilerArguments> </configuration> </plugin> </plugins> </build>
The transition is over. It should be something like this:

Additionally:
Some directories (in the image) are marked with flowers or icons - this is a sign that the environment recognized this project as a maven project. You can verify / recall (or change the visual hint by directory) in File -> Project Structure -> Modules: Source: Mark as
If the environment did not immediately recognize the project, then: View-> Tool Windows-> Maven Projects (or the same tab on the right side) -> Reimport All Maven Projects (two big arrows - under the type of the "refresh" icon)
java.lang.NullPointerException errors may occur: Location is required. In this case, check the paths to fxml files. For example, in my example it looks like this (where the first / is the resources directory):
Parent root = FXMLLoader.load(getClass().getResource("/fxml/sample.fxml"));
When adding dependencies, the environment will show a pop-up message with a choice (Autoimport disable, Autoimport enable). Choose enable (automatic loading of dependencies specified in the pom file)