javamavenjarpackage

Maven package is not visible compile error


I am using maven within VS Code and am getting a compile error from a jar I loaded from the mvn central repository.

package com.fazecast.jSerialComm is not visible

The import is declared as:

import com.fazecast.jSerialComm.SerialPort;

The pom.xml has:

<dependency>
    <groupId>com.fazecast</groupId>
    <artifactId>jSerialComm</artifactId>
    <version>2.9.1</version>
</dependency>

The jar is at C:\Users\ray\.m2\repository\com\fazecast\jSerialComm\2.9.1\jSerialComm-2.9.1.jar

What simple bone headed thing am I missing here? Thanks!

Edit: The module.info content is as follows:

    requires javafx.controls;
    requires javafx.fxml;
    
    opens com.mystuff to javafx.fxml;
    exports com.mystuff;
}

Solution

  • Well, I tripped across the solution. My module-info.java needed an additional requires added to it:

    module com.mystuff{
        requires javafx.controls;
        requires javafx.fxml;
        requires com.fazecast.jSerialComm;
    
        opens com.mystuff to javafx.fxml;
        exports com.mystuff;
    }