selenium: Can't compile Java9 module with selenium-java as dependency

Selenium Version:
3.11.0

I’m trying to build a Java9 module which has selenium-java as maven dependency.

My module-info.java looks something like this:

module my.module {

    exports my.package;

    requires httpcore;
    requires json;
    requires selenium.api;
    requires selenium.chrome.driver;
    requires selenium.edge.driver;
    requires selenium.firefox.driver;
    requires selenium.ie.driver;
    requires selenium.remote.driver;
    requires selenium.support;
}

However, when compiling my module with maven I get the following error message: module my.module reads package org.openqa.selenium.logging from both selenium.api and selenium.remote.driver

This seems to happen, because both selenium-api and selenium-remote-driver contain a package called “org.openqa.selenium.logging”. Java 9 (and all later versions) forbid this. This problem is called “split packages”.

Is there any chance, we can get this problem fixed in the next releases? Or is there some other dependecy I should use instead of selenium-java (for example a single JAR that contains everything)?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@joerg1985 I’ve just submitted the pull request for this.

I think we resolved the split package problem a while ago, but only by accident as we tidied up our build files 😃

I’ve spent the past few days working on the Java module support, and I think it’s now a lot better. We infer the module names from the Maven coordinates (so org.seleniumhq.selenium:selenium-api becomes the module org.seleniumhq.selenium.api and org.seleniumhq.selenium:selenium-firefox-driver becomes the module org.seleniumhq.selenium.firefox_driver) so those should always be in sync. I think we’ve correctly opened the modules to each other as necessary (please let me know if we haven’t!) and we should have also exposed the services correctly.

Some of our transitive dependencies are automatic modules, so unfortunately you can’t yet use jlink to generate a standalone application. We’re working to resolve that problem too.

Your example repo was particularly useful for resolving this issue, so please accept my thanks for setting that up!

I’m going to mark this issue as closed, but please LMK if there’s still an issue once the beta ships.