Maven Compile and Build Failure for Apache Beam Runner

Answered

I am running into the following Compilation Error and Build Error when executing the mvn clean compile -X command on my terminal.

 

Compilation Error 

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /<path to my java project location./../beamtutorial/src/main/java/module-info.java>:[5,37] modul
e not found: org.apache.beam.runners.direct

Build Failure Error 

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project beamtutorial: Compilation failure
[ERROR] <path to my java project location...//beamtutorial/src/main/java/module-info.java:[5,37] modul
e not found: org.apache.beam.runners.direct

 

How can I fix the errors I am running into during the compile step . Please advise

 

0
4 comments

Hi @Kumud Advani it seems that your issue is not related to IDEA.

> beamtutorial/src/main/java/module-info.java:[5,37] module not found: org.apache.beam.runners.direct

Please open this `module-info.java` and check if something is wrong there.
You use a module name named `org.apache.beam.runners.direct` but the compiler can't find it. You may use the wrong module name or this module indeed doesn't exist.

0

hello Chen , 

Thank you for your response . Here are the details of the module-info.java file .My module-info entry looks like 

module com.example.beamtutorial {
    requires javafx.controls;
    requires javafx.fxml;
    requires org.apache.beam.sdk;
    requires org.apache.beam.runners.direct;
    requires lombok;

    opens com.example.beamtutorial to javafx.fxml;
    exports com.example.beamtutorial;
}

and i have the beam library (apache.beam.runners.direct.java ) downloaded in my project folder .

 

0

Hello Chen ,

I have another project where i am using the same beam libraries and i dont see any compilation error . But i do see build errors .

This time its complaining on invalid module-path .

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.092 s
[INFO] Finished at: 2023-02-02T08:40:27-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project testpipeline: Fatal error compiling: invalid flag: --module-path -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project testpipeline: Fatal error compiling 
0

> and i have the beam library (apache.beam.runners.direct.java ) downloaded in my project folder .

You need to add this library to the pom.xml to add it for the Maven project to make it work:

The Maven doesn't read the IDEA's library settings to load the library and uses the `pom.xml` to check libraries.

```

<dependency>
    <groupId>org.apache.beam</groupId>
    <artifactId>beam-runners-direct-java</artifactId>
    <version>2.44.0</version>
    <scope>test</scope>
</dependency>

```

> I have another project where i am using the same beam libraries and i dont see any compilation error . But i do see build errors .

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project testpipeline: Fatal error compiling: invalid flag: --module-path 

 

Please try the suggestions here to see if it helps: https://stackoverflow.com/q/46118716/

0

Please sign in to leave a comment.