> On Jun 19, 2021, at 11:42 AM, Volkan Yazıcı <volkan.yaz...@gmail.com> wrote:
>
> Why do we need both a -test and -unittest modules? Can't we configure
> surefire and failsafe to simply run the tests in the "main" of -test module?
a) The way Maven currently supports JPMS unit testing I can’t be sure that
placing the unit tests in a separate Maven module would work at all.
b) In a standard build “main” classes are built before test classes. But the
unit tests require classes from the test jar so those classes must be compiled
and packaged prior to running the tests.
Ralph
>
> A back of the envelope calculate yields the following:
>
> $ grep '<type>test-jar</type>' -RHn . -C 3 | grep '<artifactId>log4j' | sed
> -r 's/.*<artifactId>(.*)<\/artifactId>/\1/g' | sort | uniq
> log4j-api
> log4j-core
> log4j-jdbc
> log4j-layout-jackson
> log4j-layout-template-json
> log4j-plugins
>
> layout testJars are needed by perf. jdbc testJar is needed by jdbc-dbcp2.
> We can work these both out and avoid them. There remains only 3 modules
> that we need to create a -test module for: api, core, and plugins.
>
>
>
> On Sat, Jun 19, 2021 at 7:33 PM Ralph Goers <ralph.go...@dslextreme.com>
> wrote:
>
>> If you did that then it would require that instead of the Log4j-api module
>> producing the log4j-api jar and log4j-api test jar you would end up with
>>
>> * log4j-api - with no tests.
>> * log4j-api-test - creates the test jar.
>> * log4j-api-unittest - contains and runs the unit tests.
>>
>> I’d rather live with the single module weirdness than need 3 modules.
>>
>> Ralph
>>
>>> On Jun 19, 2021, at 9:53 AM, Matt Sicker <boa...@gmail.com> wrote:
>>>
>>> I think the idea would be to separate the reusable test code into their
>> own
>>> main modules which depend on JUnit and such which are only consumed by
>> test
>>> modules. I think this approach could potentially work, but we’d end up
>> with
>>> a few more published jars.
>>>
>>> On Sat, Jun 19, 2021 at 11:28 Ralph Goers <ralph.go...@dslextreme.com>
>>> wrote:
>>>
>>>>
>>>>
>>>>> On Jun 19, 2021, at 3:45 AM, Volkan Yazıcı <volkan.yaz...@gmail.com>
>>>> wrote:
>>>>>
>>>>> That README is such a gem Ralph! Thanks for documenting all that
>>>> suffering.
>>>>> (README says Log4j 2 supports JPMS, shouldn't it rather be Log4j 3?)
>>>>
>>>> No, I consider it Log4j 2 version 3.0. IOW, the 2 is just part of the
>>>> name. I can see
>>>> where you might prefer just Log4j 3.0 though.
>>>>
>>>>>
>>>>> There are actually pretty few modules whose test JARs are used by the
>>>>> downstream, mostly by log4j-perf. Could it be a viable option to move
>> the
>>>>> benchmarks in log4j-perf to their associated modules (under src/perf?)
>>>>> and/or convert tests that produce test JARs into separate Maven
>> modules,
>>>>> e.g., log4j-core-test, log4j-layout-template-json-test? With my pretty
>>>>> limited understanding of JPMS, I have the impression that this might
>> ease
>>>>> the build pain to a certain extent.
>>>>
>>>> I don’t think that is quite true. The test classes included in the test
>>>> jars of
>>>> log4j-api, log4j-plugins, and log4j-core are all used by the unit tests
>> in
>>>> the
>>>> other modules. Log4j-perf doesn’t even have any test classes and doesn’t
>>>> have any dependencies on test jars.
>>>>
>>>> Ralph
>>>>
>>
>>
>>