Mailing List Archive

module not found error in intellij
In IntelliJ building Lucene main branch I see this:

.../workspace/lucene/lucene/core.tests/src/test/module-info.java:23:
error: module not found: org.apache.lucene.core.tests.main
requires org.apache.lucene.core.tests.main;
^

Am I doing it wrong? Does anybody else encounter this? I tried
re-importing the Gradle model, which succeeds, but then when I build
the project I get the above error.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
Re: module not found error in intellij [ In reply to ]
Hi Mike,
I also can't run the tests in lucene/core.tests with IntelliJ IDEA,
but it should be able to run with the plain gradle command from a
console.
./gradlew -p lucene/core.tests/ test

I'm not sure the exact cause of that though IDEs' java module support
looks far from perfect for now, I would recommend not to use IDE when
running modular tests...

Tomoko

2022?6?2?(?) 23:44 Michael Sokolov <msokolov@gmail.com>:
>
> In IntelliJ building Lucene main branch I see this:
>
> .../workspace/lucene/lucene/core.tests/src/test/module-info.java:23:
> error: module not found: org.apache.lucene.core.tests.main
> requires org.apache.lucene.core.tests.main;
> ^
>
> Am I doing it wrong? Does anybody else encounter this? I tried
> re-importing the Gradle model, which succeeds, but then when I build
> the project I get the above error.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
Re: module not found error in intellij [ In reply to ]
glad to know I'm not the only one! I think it's not OK though. Running
tests in IDE is super useful, especially for debugging, but also for
visualizing coverage. I think there must be a bug; we do say:

11:15 $ ./gradlew helpIDEs

> Task :helpIDEs

IntelliJ IDEA
=============

Importing the project as a gradle project should just run out of the box.

On Thu, Jun 2, 2022 at 11:11 AM Tomoko Uchida
<tomoko.uchida.1111@gmail.com> wrote:
>
> Hi Mike,
> I also can't run the tests in lucene/core.tests with IntelliJ IDEA,
> but it should be able to run with the plain gradle command from a
> console.
> ./gradlew -p lucene/core.tests/ test
>
> I'm not sure the exact cause of that though IDEs' java module support
> looks far from perfect for now, I would recommend not to use IDE when
> running modular tests...
>
> Tomoko
>
> 2022?6?2?(?) 23:44 Michael Sokolov <msokolov@gmail.com>:
> >
> > In IntelliJ building Lucene main branch I see this:
> >
> > .../workspace/lucene/lucene/core.tests/src/test/module-info.java:23:
> > error: module not found: org.apache.lucene.core.tests.main
> > requires org.apache.lucene.core.tests.main;
> > ^
> >
> > Am I doing it wrong? Does anybody else encounter this? I tried
> > re-importing the Gradle model, which succeeds, but then when I build
> > the project I get the above error.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: dev-help@lucene.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
Re: module not found error in intellij [ In reply to ]
Yes I agree with there may be bugs (I couldn't find the corresponding
issue in IDEA's issue tracker), they are just not our bugs...


2022?6?3?(?) 0:17 Michael Sokolov <msokolov@gmail.com>:
>
> glad to know I'm not the only one! I think it's not OK though. Running
> tests in IDE is super useful, especially for debugging, but also for
> visualizing coverage. I think there must be a bug; we do say:
>
> 11:15 $ ./gradlew helpIDEs
>
> > Task :helpIDEs
>
> IntelliJ IDEA
> =============
>
> Importing the project as a gradle project should just run out of the box.
>
> On Thu, Jun 2, 2022 at 11:11 AM Tomoko Uchida
> <tomoko.uchida.1111@gmail.com> wrote:
> >
> > Hi Mike,
> > I also can't run the tests in lucene/core.tests with IntelliJ IDEA,
> > but it should be able to run with the plain gradle command from a
> > console.
> > ./gradlew -p lucene/core.tests/ test
> >
> > I'm not sure the exact cause of that though IDEs' java module support
> > looks far from perfect for now, I would recommend not to use IDE when
> > running modular tests...
> >
> > Tomoko
> >
> > 2022?6?2?(?) 23:44 Michael Sokolov <msokolov@gmail.com>:
> > >
> > > In IntelliJ building Lucene main branch I see this:
> > >
> > > .../workspace/lucene/lucene/core.tests/src/test/module-info.java:23:
> > > error: module not found: org.apache.lucene.core.tests.main
> > > requires org.apache.lucene.core.tests.main;
> > > ^
> > >
> > > Am I doing it wrong? Does anybody else encounter this? I tried
> > > re-importing the Gradle model, which succeeds, but then when I build
> > > the project I get the above error.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: dev-help@lucene.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: dev-help@lucene.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
Re: module not found error in intellij [ In reply to ]
I was able to run tests in IDEA by removing all the module-info.jar,
so indeed, seems to be some kind of interaction with modules

On Thu, Jun 2, 2022 at 11:36 AM Tomoko Uchida
<tomoko.uchida.1111@gmail.com> wrote:
>
> Yes I agree with there may be bugs (I couldn't find the corresponding
> issue in IDEA's issue tracker), they are just not our bugs...
>
>
> 2022?6?3?(?) 0:17 Michael Sokolov <msokolov@gmail.com>:
> >
> > glad to know I'm not the only one! I think it's not OK though. Running
> > tests in IDE is super useful, especially for debugging, but also for
> > visualizing coverage. I think there must be a bug; we do say:
> >
> > 11:15 $ ./gradlew helpIDEs
> >
> > > Task :helpIDEs
> >
> > IntelliJ IDEA
> > =============
> >
> > Importing the project as a gradle project should just run out of the box.
> >
> > On Thu, Jun 2, 2022 at 11:11 AM Tomoko Uchida
> > <tomoko.uchida.1111@gmail.com> wrote:
> > >
> > > Hi Mike,
> > > I also can't run the tests in lucene/core.tests with IntelliJ IDEA,
> > > but it should be able to run with the plain gradle command from a
> > > console.
> > > ./gradlew -p lucene/core.tests/ test
> > >
> > > I'm not sure the exact cause of that though IDEs' java module support
> > > looks far from perfect for now, I would recommend not to use IDE when
> > > running modular tests...
> > >
> > > Tomoko
> > >
> > > 2022?6?2?(?) 23:44 Michael Sokolov <msokolov@gmail.com>:
> > > >
> > > > In IntelliJ building Lucene main branch I see this:
> > > >
> > > > .../workspace/lucene/lucene/core.tests/src/test/module-info.java:23:
> > > > error: module not found: org.apache.lucene.core.tests.main
> > > > requires org.apache.lucene.core.tests.main;
> > > > ^
> > > >
> > > > Am I doing it wrong? Does anybody else encounter this? I tried
> > > > re-importing the Gradle model, which succeeds, but then when I build
> > > > the project I get the above error.
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> > > > For additional commands, e-mail: dev-help@lucene.apache.org
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: dev-help@lucene.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: dev-help@lucene.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
Re: module not found error in intellij [ In reply to ]
Thanks for confirming, just to be clear - the module descriptor
shouldn't affect the existing (in-module) tests, you can run them with
a debugger with IDEs.
Problems can happen when running the inter-module tests via IDE (we
have three, lucene/core.tests, lucene/analysis.tests, and
lucene/distribution.tests. I've seen lucene/core.tests and
lucene/analysis.tests fail with different errors,
lucene/distribution.tests passes).


2022?6?3?(?) 1:22 Michael Sokolov <msokolov@gmail.com>:
>
> I was able to run tests in IDEA by removing all the module-info.jar,
> so indeed, seems to be some kind of interaction with modules
>
> On Thu, Jun 2, 2022 at 11:36 AM Tomoko Uchida
> <tomoko.uchida.1111@gmail.com> wrote:
> >
> > Yes I agree with there may be bugs (I couldn't find the corresponding
> > issue in IDEA's issue tracker), they are just not our bugs...
> >
> >
> > 2022?6?3?(?) 0:17 Michael Sokolov <msokolov@gmail.com>:
> > >
> > > glad to know I'm not the only one! I think it's not OK though. Running
> > > tests in IDE is super useful, especially for debugging, but also for
> > > visualizing coverage. I think there must be a bug; we do say:
> > >
> > > 11:15 $ ./gradlew helpIDEs
> > >
> > > > Task :helpIDEs
> > >
> > > IntelliJ IDEA
> > > =============
> > >
> > > Importing the project as a gradle project should just run out of the box.
> > >
> > > On Thu, Jun 2, 2022 at 11:11 AM Tomoko Uchida
> > > <tomoko.uchida.1111@gmail.com> wrote:
> > > >
> > > > Hi Mike,
> > > > I also can't run the tests in lucene/core.tests with IntelliJ IDEA,
> > > > but it should be able to run with the plain gradle command from a
> > > > console.
> > > > ./gradlew -p lucene/core.tests/ test
> > > >
> > > > I'm not sure the exact cause of that though IDEs' java module support
> > > > looks far from perfect for now, I would recommend not to use IDE when
> > > > running modular tests...
> > > >
> > > > Tomoko
> > > >
> > > > 2022?6?2?(?) 23:44 Michael Sokolov <msokolov@gmail.com>:
> > > > >
> > > > > In IntelliJ building Lucene main branch I see this:
> > > > >
> > > > > .../workspace/lucene/lucene/core.tests/src/test/module-info.java:23:
> > > > > error: module not found: org.apache.lucene.core.tests.main
> > > > > requires org.apache.lucene.core.tests.main;
> > > > > ^
> > > > >
> > > > > Am I doing it wrong? Does anybody else encounter this? I tried
> > > > > re-importing the Gradle model, which succeeds, but then when I build
> > > > > the project I get the above error.
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> > > > > For additional commands, e-mail: dev-help@lucene.apache.org
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> > > > For additional commands, e-mail: dev-help@lucene.apache.org
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: dev-help@lucene.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: dev-help@lucene.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
Re: module not found error in intellij [ In reply to ]
Hi Mike,

It used to work all right - something must have changed somewhere that
caused this regression. :(

I just reimported the latest main branch in IntelliJ with the default
settings and it compiled fine -

[image: image.png]

This, I think, invokes gradle assemble which in turn causes many additional
tasks to be invoked (like jar or javadocs). This can be improved - we don't
need these tasks to be assembled in intellij compilation mode. It's hacky
but I've done it in the past.

When I switch to (my preferred) intellij compilation, things break. This is
definitely a regression in IntelliJ somewhere because it used to work very
recently - until the last update, I think. Everything in the module
settings seems all right so I don't know...

For now, the relatively easy workaround is to build and run via gradle but
run tests using intellij (the dialog above). Should work.

Dawid


On Thu, Jun 2, 2022 at 4:44 PM Michael Sokolov <msokolov@gmail.com> wrote:

> In IntelliJ building Lucene main branch I see this:
>
> .../workspace/lucene/lucene/core.tests/src/test/module-info.java:23:
> error: module not found: org.apache.lucene.core.tests.main
> requires org.apache.lucene.core.tests.main;
> ^
>
> Am I doing it wrong? Does anybody else encounter this? I tried
> re-importing the Gradle model, which succeeds, but then when I build
> the project I get the above error.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>
Re: module not found error in intellij [ In reply to ]
Hmmm... I retried again and this time the gradle build (within intellij)
failed but the Idea one (that runs via generated ant tasks) passed. I can
also run (some) tests in this mode. Certain tests depend on resources that
live under java sources - these resources are not copied by intellij by
default so won't work.

Back to "gradle" compilation mode - the gradle command IntelliJ uses to
compile sources fails there but succeeds if run from command line. I think
something has changed that interferes with what we have in modules.gradle -
there are conditional classpath settings there that were used to make
intellij compile the sources in modular mode. Something has changed and
this no longer works properly. This may be a trivial change somewhere but
it's a moving target, eh.

Dawid

On Fri, Jun 3, 2022 at 8:53 AM Dawid Weiss <dawid.weiss@gmail.com> wrote:

>
> Hi Mike,
>
> It used to work all right - something must have changed somewhere that
> caused this regression. :(
>
> I just reimported the latest main branch in IntelliJ with the default
> settings and it compiled fine -
>
> [image: image.png]
>
> This, I think, invokes gradle assemble which in turn causes many
> additional tasks to be invoked (like jar or javadocs). This can be improved
> - we don't need these tasks to be assembled in intellij compilation mode.
> It's hacky but I've done it in the past.
>
> When I switch to (my preferred) intellij compilation, things break. This
> is definitely a regression in IntelliJ somewhere because it used to work
> very recently - until the last update, I think. Everything in the module
> settings seems all right so I don't know...
>
> For now, the relatively easy workaround is to build and run via gradle but
> run tests using intellij (the dialog above). Should work.
>
> Dawid
>
>
> On Thu, Jun 2, 2022 at 4:44 PM Michael Sokolov <msokolov@gmail.com> wrote:
>
>> In IntelliJ building Lucene main branch I see this:
>>
>> .../workspace/lucene/lucene/core.tests/src/test/module-info.java:23:
>> error: module not found: org.apache.lucene.core.tests.main
>> requires org.apache.lucene.core.tests.main;
>> ^
>>
>> Am I doing it wrong? Does anybody else encounter this? I tried
>> re-importing the Gradle model, which succeeds, but then when I build
>> the project I get the above error.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>>
Re: module not found error in intellij [ In reply to ]
This seems to work -
https://github.com/apache/lucene/pull/945

I have not tested extensively though and I think it is crucial that both
"compilation modes" in intellij work. I'm in an out for the weekend but
feedback would be welcome if the above patch works for people (it'd also
simplify the gradle code).

Dawid

On Fri, Jun 3, 2022 at 9:54 AM Dawid Weiss <dawid.weiss@gmail.com> wrote:

>
> Hmmm... I retried again and this time the gradle build (within intellij)
> failed but the Idea one (that runs via generated ant tasks) passed. I can
> also run (some) tests in this mode. Certain tests depend on resources that
> live under java sources - these resources are not copied by intellij by
> default so won't work.
>
> Back to "gradle" compilation mode - the gradle command IntelliJ uses to
> compile sources fails there but succeeds if run from command line. I think
> something has changed that interferes with what we have in modules.gradle -
> there are conditional classpath settings there that were used to make
> intellij compile the sources in modular mode. Something has changed and
> this no longer works properly. This may be a trivial change somewhere but
> it's a moving target, eh.
>
> Dawid
>
> On Fri, Jun 3, 2022 at 8:53 AM Dawid Weiss <dawid.weiss@gmail.com> wrote:
>
>>
>> Hi Mike,
>>
>> It used to work all right - something must have changed somewhere that
>> caused this regression. :(
>>
>> I just reimported the latest main branch in IntelliJ with the default
>> settings and it compiled fine -
>>
>> [image: image.png]
>>
>> This, I think, invokes gradle assemble which in turn causes many
>> additional tasks to be invoked (like jar or javadocs). This can be improved
>> - we don't need these tasks to be assembled in intellij compilation mode.
>> It's hacky but I've done it in the past.
>>
>> When I switch to (my preferred) intellij compilation, things break. This
>> is definitely a regression in IntelliJ somewhere because it used to work
>> very recently - until the last update, I think. Everything in the module
>> settings seems all right so I don't know...
>>
>> For now, the relatively easy workaround is to build and run via gradle
>> but run tests using intellij (the dialog above). Should work.
>>
>> Dawid
>>
>>
>> On Thu, Jun 2, 2022 at 4:44 PM Michael Sokolov <msokolov@gmail.com>
>> wrote:
>>
>>> In IntelliJ building Lucene main branch I see this:
>>>
>>> .../workspace/lucene/lucene/core.tests/src/test/module-info.java:23:
>>> error: module not found: org.apache.lucene.core.tests.main
>>> requires org.apache.lucene.core.tests.main;
>>> ^
>>>
>>> Am I doing it wrong? Does anybody else encounter this? I tried
>>> re-importing the Gradle model, which succeeds, but then when I build
>>> the project I get the above error.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: dev-help@lucene.apache.org
>>>
>>>
Re: module not found error in intellij [ In reply to ]
Thanks for digging, Dawid! I was not really aware of the choice of modes in
IntelliJ, but I think it is especially important for the "out of the box"
promise that the Gradle mode works? I'll try the patch and report back;
thanks again.

On Fri, Jun 3, 2022 at 4:04 AM Dawid Weiss <dawid.weiss@gmail.com> wrote:

>
> This seems to work -
> https://github.com/apache/lucene/pull/945
>
> I have not tested extensively though and I think it is crucial that both
> "compilation modes" in intellij work. I'm in an out for the weekend but
> feedback would be welcome if the above patch works for people (it'd also
> simplify the gradle code).
>
> Dawid
>
> On Fri, Jun 3, 2022 at 9:54 AM Dawid Weiss <dawid.weiss@gmail.com> wrote:
>
>>
>> Hmmm... I retried again and this time the gradle build (within intellij)
>> failed but the Idea one (that runs via generated ant tasks) passed. I can
>> also run (some) tests in this mode. Certain tests depend on resources that
>> live under java sources - these resources are not copied by intellij by
>> default so won't work.
>>
>> Back to "gradle" compilation mode - the gradle command IntelliJ uses to
>> compile sources fails there but succeeds if run from command line. I think
>> something has changed that interferes with what we have in modules.gradle -
>> there are conditional classpath settings there that were used to make
>> intellij compile the sources in modular mode. Something has changed and
>> this no longer works properly. This may be a trivial change somewhere but
>> it's a moving target, eh.
>>
>> Dawid
>>
>> On Fri, Jun 3, 2022 at 8:53 AM Dawid Weiss <dawid.weiss@gmail.com> wrote:
>>
>>>
>>> Hi Mike,
>>>
>>> It used to work all right - something must have changed somewhere that
>>> caused this regression. :(
>>>
>>> I just reimported the latest main branch in IntelliJ with the default
>>> settings and it compiled fine -
>>>
>>> [image: image.png]
>>>
>>> This, I think, invokes gradle assemble which in turn causes many
>>> additional tasks to be invoked (like jar or javadocs). This can be improved
>>> - we don't need these tasks to be assembled in intellij compilation mode.
>>> It's hacky but I've done it in the past.
>>>
>>> When I switch to (my preferred) intellij compilation, things break. This
>>> is definitely a regression in IntelliJ somewhere because it used to work
>>> very recently - until the last update, I think. Everything in the module
>>> settings seems all right so I don't know...
>>>
>>> For now, the relatively easy workaround is to build and run via gradle
>>> but run tests using intellij (the dialog above). Should work.
>>>
>>> Dawid
>>>
>>>
>>> On Thu, Jun 2, 2022 at 4:44 PM Michael Sokolov <msokolov@gmail.com>
>>> wrote:
>>>
>>>> In IntelliJ building Lucene main branch I see this:
>>>>
>>>> .../workspace/lucene/lucene/core.tests/src/test/module-info.java:23:
>>>> error: module not found: org.apache.lucene.core.tests.main
>>>> requires org.apache.lucene.core.tests.main;
>>>> ^
>>>>
>>>> Am I doing it wrong? Does anybody else encounter this? I tried
>>>> re-importing the Gradle model, which succeeds, but then when I build
>>>> the project I get the above error.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>>>> For additional commands, e-mail: dev-help@lucene.apache.org
>>>>
>>>>