This question already has an answer here:
Cannot resolve symbol 'WebView'. JavaFX WebView with Maven in IntelliJ IDEA [duplicate]
(1 answer)
Closed last month.
I'm new to maven and java projects as a whole and I've been trying to add javafx.web to my Maven project, specifically for the HTMLEditor class, on VS Code and so far have been unable to.
I've added the dependency to the pom.xml file and put in VM Arguments that lead to my installation of JavaFX and nothing has worked.
Is there a way to do this that I'm missing or would it be better to just add a copy of the javafx.web.jar that is in the JavaFX\javafx-sdk\lib folder directly somehow?
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>dylan.gresham</groupId>
<artifactId>nottah</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>19</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running -->
<!-- Usage: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>dylan.gresham.Main</mainClass>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>dylan.gresham.Driver</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
My VM Arguments:
--module-path C:\Users\dylan\Downloads\JavaFX\javafx-sdk-18.0.1\lib --add-modules =ALL -MODULE-PATH
My module-info.java:
module dylan.gresham {
requires javafx.controls;
requires javafx.fxml;
requires transitive javafx.graphics;
opens dylan.gresham to javafx.fxml;
exports dylan.gresham;
}
Edit: Added module-info file above.
As pointed out by #James_D I needed to add requires javafx.web; to my module-info.java file. After adding that line I was able to import what I needed to.
Related
I'm working on revamping a JavaFX project I created back in 2018. I have the original main script but now there seems to be 2 FX related errors now. import javax.imageio.ImageIO; import java.awt.image.BufferedImage; I am using Apache NetBeans with Maven version 12.5 and I am using OpenJDK 17 and OpenJFX 17.
The error is saying for both that these packages are not visible, and that they are declared in module java.desktop but module com.mycompany.realestate2021 does not read it.
pom.xml portion below
<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.mycompany</groupId>
<artifactId>RealEstate2021</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>13</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>com.mycompany.realestate2021.App</mainClass>
</configuration>
<executions>
<execution>
<!-- Default configuration for running -->
<!-- Usage: mvn clean javafx:run -->
<id>default-cli</id>
</execution>
<execution>
<!-- Configuration for manual attach debugging -->
<!-- Usage: mvn clean javafx:run#debug -->
<id>debug</id>
<configuration>
<options>
<option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:8000</option>
</options>
</configuration>
</execution>
<execution>
<!-- Configuration for automatic IDE debugging -->
<id>ide-debug</id>
<configuration>
<options>
<option>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</option>
</options>
</configuration>
</execution>
<execution>
<!-- Configuration for automatic IDE profiling -->
<id>ide-profile</id>
<configuration>
<options>
<option>${profiler.jvmargs.arg1}</option>
<option>${profiler.jvmargs.arg2}</option>
<option>${profiler.jvmargs.arg3}</option>
<option>${profiler.jvmargs.arg4}</option>
<option>${profiler.jvmargs.arg5}</option>
</options>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
How do I fix this issue(s)?
Check the module-info.java for your project, and make sure that it contains a line for "java.desktop":
module xyz {
requires transitive java.desktop;
... }
This declares that your project uses the definitions from java.desktop - which include BufferedImage. You may also need declarations for JavaFX such as:
requires transitive javafx.base;
requires transitive javafx.controls; // etc
requires transitive javafx.graphics;
I want to use the gson library from com.google and tried adding it to my Maven-project via the pom, the module maven import, etc, but even though it shows up in my external libraries, Intellij tells me, that package doesn't exist. I tried reloading, restarting, removing it, invalidating the chache etc, nothing helps, can anybody help please?
import com.google.gson
and the specific errorcode:
Error:(9, 18) java: package com.google does not exist
My .pom file:
<?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.Avalon</groupId>
<artifactId>Battlesheet</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Avalon</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.14</maven.compiler.source>
<maven.compiler.target>1.14</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>13</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>15-ea+6</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-assembly-plugin -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>assembly.Launcher</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>assembly.Launcher</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
</project>
You got wrong import com.google.gson;
It's should be replaced by import com.google.gson.* or import com.google.gson.Gson, if that doesn't help, try to reimport dependencies through Maven tool, as shown in the screenshot below.
Hope that will help.
Go to File -> Project Structure click on the library tab on the side. You can add or remove any libraries.
everyone!
I've tried to create .jar file by Maven with dependence on JavaFX according to this post. Unfortunately, attempts was failed. In folder targets creating two files:
MAVEN_UI_INTRO-1.0-SNAPSHOT.jar
original-MAVEN_UI_INTRO-1.0-SNAPSHOT.jar
With first file, I get this error:
Error: JavaFX runtime components are missing, and are required to run this application
With second file, this error:
no main manifest attribute, in target/original-MAVEN_UI_INTRO-1.0-SNAPSHOT.jar
Build by command mvn clean package
Start by command java -jar target/"someJarFile.jar"
Main question: What do I wrong?
UPD: 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.novalab</groupId>
<artifactId>MAVEN_UI_INTRO</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.novalab.App</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.1</version>
<configuration>
<mainClass>com.novalab.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
I am in the process of converting a working java 8 project to java 11. I don't want to use module yet (I know there are some advantages, but so far I just want the project to run under java 11). So there is no module-info.java in the project src folder.
I use Netbeans 11, and the (Maven based) project can be successfully built (with openjdk 11 under Linux). However when I run it, I get
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /home/helloWorld/.m2/repository/org/apache/tika/tika-parsers/1.21/tika-parsers-1.21.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.apache.tika.parser.external.CompositeExternalParser not in module
My classes are all in packages so this answer does not fit, and neither does this other one.
The project pom.xml is as follows :
<?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>MRE</groupId>
<artifactId>Example</artifactId>
<version>1.0.12</version>
<packaging>jar</packaging>
<parent>
<artifactId>MREWeb</artifactId>
<groupId>MRE</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>MRE</groupId>
<artifactId>Base</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>1.21</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.opennlp</groupId>
<artifactId>opennlp-tools</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>net.sourceforge</groupId>
<artifactId>prajna</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-rules</artifactId>
<version>1.19.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11.0.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
</dependency>
<build>
<resources>
<resource>
<!--We specify the resource folder that should be included-->
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.3.9</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<!--See here for details https://www.baeldung.com/executable-jar-with-maven-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
${mainClass}
</mainClass>
</manifest>
<!--Adds custom entry for version to manifest and changes Built By value-->
<manifestEntries>
<!--We use implementation version so that it can be retrieved within java from package methods-->
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Title>${project.artifactId}</Implementation-Title>
<Built-By>HelloWorld</Built-By>
</manifestEntries>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.2</version>
<configuration>
<mainClass>${mainClass}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
</plugins>
</build>
<name>MREWeb_Example</name>
</project>
The command line that Netbeans output in its console is :
cd /home/helloWorld/java/projects/example;
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
/home/helloworld/netbeans/java/maven/bin/mvn "-Dexec.args=-classpath
%classpath mre.example.MainApp"
-Dexec.executable=/usr/lib/jvm/java-11-openjdk-amd64/bin/java -DskipTests=true clean javafx:run
How can I put the CompositeExternalParser class in the module (which module indeed) ?
Edit (after adding javafx to the module-path and add-modules as advised in comments)
If I run the compiled (fat) jar from the command line via java --module-path /home/helloworld/Java/JavaFx/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.fxml -jar example-jar-with-dependencies.jar the app runs fine. So there rather be something to do rather in Netbeans, right (but what ;-) )?
Minimal Reproducible Example (as requested in the comments)
Create a new Maven project via Maven Archetype (javafx-archetype-simple) and follow OpenJfX tutorial for non modular maven project in Netbeans
Add Tika parser dependency in pom.xml
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>1.21</version>
<type>jar</type>
</dependency>
The pom.xml becomes
<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>minimum.reproducible</groupId>
<artifactId>MavenExample</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>1.21</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.2</version>
<configuration>
<mainClass>minimum.reproducible.mavenexample.App</mainClass>
</configuration>
</plugin>
<!--To include the main class attribute in the manifest file-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifest>
<mainClass>minimum.reproducible.mavenexample.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Add this method from Tika example
public String parseExample() throws IOException, SAXException, TikaException {
AutoDetectParser parser = new AutoDetectParser();
BodyContentHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata();
try (InputStream stream = new FileInputStream(new File("/home/helloWorld/Texts/test.txt"))) {
parser.parse(stream, handler, metadata);
return handler.toString();
}
Augment the start method with some code to run the previously created method
public void start(Stage stage) {
var javaVersion = SystemInfo.javaVersion();
var javafxVersion = SystemInfo.javafxVersion();
var label = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
var scene = new Scene(new StackPane(label), 640, 480);
stage.setScene(scene);
stage.show();
System.err.println("Starting tika parsing");
try {
String result = parseExample();
System.err.println("The parsing yielded : ");
System.err.println(result);
} catch (IOException | SAXException | TikaException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE,
null,
ex);
}
}
Now clean and build and run the project. The described error should occur.
Please note : If this minimal reproducible example program is launched from the command line without Tika in Pom and the Tika related stuff in App.java the program runs fine.
java --module-path /home/helloworld/Java/JavaFx/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.fxml -jar MavenExample-1.0-SNAPSHOT.jar
However if I try to run it from the command line again but with all Tika stuff as described in the minimal reproducible example above, I get
Missing JavaFX application class minimum.reproducible.mavenexample.App
although Netbeans 11 keeps showing the java.lang.module.InvalidModuleDescriptorException mentioned above.
Yet if the following lines are added to the pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass>minimum.reproducible.mavenexample.App</mainClass>
</configuration>
</plugin>
Now the project can be run via mvn exec:java. So I guess that the issue is coming from the javafx-maven-plugin, isn't it ?
Any help appreciated ;-)
I can't use the scala-maven-plugin to build my Java-sources due to a bug in Scalac (https://issues.scala-lang.org/browse/SI-9853).
Splitting the build so that Java is compiled by the maven-compiler-plugin and Scala by the scala-maven-plugin was easy enough with the sources residing in src/main/java and src/main/scala.
Right now I am running into the problem that the Scala-classes can't see the Java-classes.
When doing mvn clean compile I get 'not found' for all Java-classes required by the Scala-classes. Checking 'target/classes' shows that the Java-classes are there.
I tried moving the Scala-build to different phases but the results remain the same.
How can I make the Scala-build see the classes already available in target/classes?
<?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>de.codepitbull.maven</groupId>
<artifactId>maven-scalac-bug</artifactId>
<version>3.4.0-SNAPSHOT</version>
<name>Scalac + Javac</name>
<properties>
<scala.version>2.11.8</scala.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<scope>provided</scope>
<version>${scala.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<sendJavaToScalac>false</sendJavaToScalac>
<args>
<arg>-target:jvm-1.8</arg>
<arg>-feature</arg>
<arg>-deprecation</arg>
<arg>-explaintypes</arg>
<arg>-unchecked</arg>
<arg>-Xlint</arg>
</args>
</configuration>
<executions>
<execution>
<id>java-compile-first</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The easiest workaround would be to split it into two submodules. That way you're able to reference the Java classes as dependency. After that generate an Uber jar or shaded jar with both modules inlined.