Giter VIP home page Giter VIP logo

Comments (8)

sormuras avatar sormuras commented on July 29, 2024 1

[...]
Even though this is definetly not a good way to do it.

Exactly. I'd go even further and state: that's an absolute no-go!

Don't mess with the main descriptor just for the purpose of testing. The main descriptor is meant to be re-used, potentially published to Maven Central and shall only contain the minimal required API to work properly.

from sawdust.

sormuras avatar sormuras commented on July 29, 2024 1

Soon, it'll work with IntelliJ's IDEA: https://youtrack.jetbrains.com/issue/IDEA-253066#focus=Comments-27-5173827.0-0

from sawdust.

sormuras avatar sormuras commented on July 29, 2024

Which IDEA module contains the error?

from sawdust.

AndreG-P avatar AndreG-P commented on July 29, 2024

Every (maven) module with two module-info.java:
modular-whitebox-patch-compile
modular-blackbox-stereo

from sawdust.

sormuras avatar sormuras commented on July 29, 2024

I see.

That's why I invented and promoted the module-info.test work-around as described in https://sormuras.github.io/blog/2018-09-11-testing-in-the-modular-world#white-box-modular-testing-with-extra-java-command-line-options

Caveat: IDEA, Maven Surefire and most other tools don't support module-info.test, though. Trying together with Robert to convince the Jigsaw-Crew to improve the situation: http://mail.openjdk.java.net/pipermail/jigsaw-dev/2020-February/thread.html#14357

from sawdust.

AndreG-P avatar AndreG-P commented on July 29, 2024

It's actually a shame that there is no proper solution yet. Java 9 is over 2 years old already.

I think I have also a small hack for this. If the test-packages also exist in the main path, one can opens the packages just to the test engine. For example, in modular-whitebox-path-compile, we can change the module-info.java in the main/java to:

module foo {
  exports foo;
  opens foo to org.junit.platform.commons;

  requires java.logging;
  requires org.junit.jupiter.api;
}

This also works with surefire and the newest versions of junit.
Even though this is definetly not a good way to do it.

from sawdust.

AndreG-P avatar AndreG-P commented on July 29, 2024

So for now (even two years since java 9), it looks like one should not mess up with Intellij, maven and jigsaw. It seems the best to avoid javas module system until there is a common solution that is supported by intellij, maven surefire, and jigsaw.

Am I right?

from sawdust.

sormuras avatar sormuras commented on July 29, 2024

It depends and only time will tell.

Jigsaw + Foundation Tools (javac, jar, javadoc, ...) are fine. Of course, there are still bugs within those tools regarding the module system support.

Most "vintage" build tools took and take Java packages as their building blocks -- due to the fact there weren't Java modules around when those tools were created. Some tools (and underlying project models) may adopt, some won't.

from sawdust.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.