In the log4j-core directory run 

mvn clean  test -Dtest=RequiredValidatorTest

Once the module has compiled you can do

mvn surefire:test -Dtest-RequiredValidatorTest

The error happens because the initial compile cannot have a module-info and it 
is finding the one from the previous build. See 
https://github.com/apache/logging-log4j2/blob/master/log4j-core/README.md for 
more details. 

FWIW, the bug reported in 
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8265826 was fixed in 
Java 17, so if we want to require Java 17 to be able to build Log4j I could get 
around at least that part of the problem.

Ralph

> On Jun 6, 2021, at 3:45 PM, Matt Sicker <boa...@gmail.com> wrote:
> 
> I can't even figure out how to execute individual tests from the
> command line. Trying to run tests in log4j-core like so give an error:
> 
> $ mvn -pl :log4j-core test -Dtest=RequiredValidatorTest
> ...
> [ERROR] COMPILATION ERROR :
> [INFO] -------------------------------------------------------------
> [ERROR] error: module not found: org.fusesource.jansi
> [ERROR] error: module not found: org.apache.commons.compress
> [ERROR] error: module not found: com.fasterxml.jackson.dataformat.yaml
> [ERROR] error: module not found: com.fasterxml.jackson.dataformat.xml
> [ERROR] error: module not found: com.fasterxml.jackson.databind
> [ERROR] error: module not found: com.fasterxml.jackson.core
> [ERROR] error: module not found: com.conversantmedia.disruptor
> [ERROR] error: module not found: org.osgi.framework
> [ERROR] error: module not found: org.jctools.core
> [ERROR] error: module not found: com.lmax.disruptor
> [ERROR] error: module not found: org.apache.logging.log4j.plugins
> [ERROR] error: module not found: org.apache.logging.log4j
> 
> Now if the only supported way to run unit tests is to run the entire
> test suite, then we have a huge problem.
> 
> On Mon, 19 Apr 2021 at 17:34, Tim Perry <tim.v...@gmail.com> wrote:
>> 
>> Can any of you recommend an idiots guide to setting up a log4j development
>> environment in IntelliJ? I have never used IntelliJ before. Eclipse won't
>> work with a maven project with multiple module-info.java files. There are
>> bugs into the maven-eclipse tools (m2e) for this.
>> 
>> I cannot see reverting to 1999 and using the command line debugger, so
>> IntelliJ seems like my best shot at getting a working development
>> environment. I just want autocomplete and the ability to connect a debugger
>> without too much hoop jumping.
>> 
>> Thanks,
>> Tim
>> 
>> On Thu, Apr 8, 2021 at 5:17 AM Volkan Yazıcı <volkan.yaz...@gmail.com>
>> wrote:
>> 
>>> I have also tried that too, but no luck so far. @Matt, are you able to run
>>> any tests from IDEA using the most recent "master"?
>>> 
>>> On Wed, Apr 7, 2021 at 5:57 PM Matt Sicker <boa...@gmail.com> wrote:
>>> 
>>>> See also
>>>> 
>>> https://lists.apache.org/thread.html/2ba2225043a6ca7d2c43e4293323309b041bd8d486516cc50fec61cd%40%3Cdev.logging.apache.org%3E
>>>> 
>>>> On Wed, 7 Apr 2021 at 09:17, Ralph Goers <ralph.go...@dslextreme.com>
>>>> wrote:
>>>>> 
>>>>> mvn surefire:test -Dtest=TestClass -Dmaven.surefire.debug=“remote debug
>>>> options”
>>>>> 
>>>>> Ralph
>>>>> 
>>>>>> On Apr 7, 2021, at 7:04 AM, Volkan Yazıcı <volkan.yaz...@gmail.com>
>>>> wrote:
>>>>>> 
>>>>>> Okay, fair enough. Thanks so much for sharing these details, I
>>> really
>>>>>> appreciated it. One final question: If you want to debug a single
>>>> test, how
>>>>>> does your work flow look like? Do you create a new "Run
>>> Configuration"
>>>>>> invoking a certain Maven command triggering the code/test that you
>>> are
>>>>>> interested in and "Debug Run"ing that "Run Configuration"?
>>>>>> 
>>>>>> For the records, I still would like to hear how I can make IDEA to
>>>> simply
>>>>>> run a test. If anybody has succeeded in doing that, I am all ears.
>>>>>> 
>>>>>>> On Wed, Apr 7, 2021 at 3:38 PM Apache <ralph.go...@dslextreme.com>
>>>> wrote:
>>>>>>> 
>>>>>>> I will be honest. I have never tun any log4j tests in IntelliJ. I
>>>> rarely
>>>>>>> do it for any projects I work on. I use JVM remote debug all the
>>>> time. I
>>>>>>> don’t want to force others to have to do that, but I just never
>>> think
>>>> about
>>>>>>> it.
>>>>>>> 
>>>>>>> I use various versions of Maven from time to time. 3.6.1 is the
>>>> default on
>>>>>>> my Mac but I just installed 3.8.1 to validate what I needed to
>>> change
>>>> in my
>>>>>>> setup to make it still work with my employers Nexus repository which
>>>> still
>>>>>>> uses http.
>>>>>>> 
>>>>>>> When I am working on Log4J stuff I do a full mvn clean install
>>> several
>>>>>>> times a day. That takes a huge amount of time so I have learned to
>>>>>>> multitask and work on other stuff while builds are running.
>>>>>>> 
>>>>>>> Ralph.
>>>>>>> 
>>>>>>>> On Apr 7, 2021, at 12:15 AM, Volkan Yazıcı <
>>> volkan.yaz...@gmail.com>
>>>>>>> wrote:
>>>>>>>> 
>>>>>>>> Ralph, when you delete the IDEA-specific configuration (i.e.,
>>> *.iml
>>>>>>> files
>>>>>>>> and .idea directory), compile the sources via Maven, and open the
>>>> folder
>>>>>>> in
>>>>>>>> IDEA, can you run *any* tests? If so, do you have any custom IDEA
>>>>>>>> configurations? Which IDEA version are you using? If you are not
>>>> using
>>>>>>> the
>>>>>>>> wrapper, which Maven version are you using?
>>>>>>>> 
>>>>>>>> I use Maven Wrapper to make sure Maven behaves the same in all
>>>>>>>> environments, independent of my local setup. It also saves you
>>> from a
>>>>>>> local
>>>>>>>> Maven dependency.
>>>>>>>> 
>>>>>>>>> On Wed, Apr 7, 2021 at 1:17 AM Ralph Goers <
>>>> ralph.go...@dslextreme.com>
>>>>>>>>> wrote:
>>>>>>>>> 
>>>>>>>>> I deleted the files from my local repo and restarted the build. It
>>>> is
>>>>>>>>> running along just fine - at least until it hits json template
>>>> layout.
>>>>>>>>> 
>>>>>>>>> Is there a reason you use the maven wrapper instead of Maven
>>>> itself? I
>>>>>>>>> have never used the wrapper. I am wondering if there is something
>>>> going
>>>>>>> on
>>>>>>>>> there.
>>>>>>>>> 
>>>>>>>>> Ralph
>>>>>>>>> 
>>>>>>>>>> On Apr 6, 2021, at 4:10 PM, Ralph Goers <
>>>> ralph.go...@dslextreme.com>
>>>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>> I’ve never seen that. What is
>>>> maven-annotations-production:log4j-api?
>>>>>>>>>> 
>>>>>>>>>> Let me try removing the files from my maven local repo as you
>>> did.
>>>>>>>>>> 
>>>>>>>>>> Ralph
>>>>>>>>>> 
>>>>>>>>>>> On Apr 6, 2021, at 1:14 PM, Volkan Yazıcı <
>>>> volkan.yaz...@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>>> 
>>>>>>>>>>> As subject hints, I am not able to run tests in IDEA anymore
>>> after
>>>>>>> Java
>>>>>>>>> 11
>>>>>>>>>>> upgrade. I have deleted all IDEA related files and issued a
>>> clean
>>>>>>> Maven
>>>>>>>>>>> build:
>>>>>>>>>>> 
>>>>>>>>>>> $ rm -rf ./.idea ./**/*.iml
>>>>>>>>>>> $ rm -rf ~/.m2/repository/org/apache/logging/log4j/*/3*-SNAPSHOT
>>>>>>>>>>> $ ./mvnw clean install -DskipTests=true
>>>>>>>>>>> 
>>>>>>>>>>> Opened the directory using IDEA (2021.1 RC), but couldn't get it
>>>> to
>>>>>>> have
>>>>>>>>>>> successful build:
>>>>>>>>>>> 
>>>>>>>>>>> W: Output path
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>> /home/vy/Projects/log4j/3/log4j-core/target/generated-sources/annotations
>>>>>>>>>>> intersects with a source root. Only files that were created by
>>>> build
>>>>>>>>> will
>>>>>>>>>>> be cleaned
>>>>>>>>>>> W: Output path
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>> 
>>> /home/vy/Projects/log4j/3/log4j-plugins/target/generated-test-sources/test-annotations
>>>>>>>>>>> intersects with a source root. Only files that were created by
>>>> build
>>>>>>>>> will
>>>>>>>>>>> be cleaned
>>>>>>>>>>> W: Output path
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>> 
>>> /home/vy/Projects/log4j/3/log4j-layout-template-json/target/generated-test-sources/test-annotations
>>>>>>>>>>> intersects with a source root. Only files that were created by
>>>> build
>>>>>>>>> will
>>>>>>>>>>> be cleaned
>>>>>>>>>>> W: Output path
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>> 
>>> /home/vy/Projects/log4j/3/log4j-plugins/target/generated-sources/annotations
>>>>>>>>>>> intersects with a source root. Only files that were created by
>>>> build
>>>>>>>>> will
>>>>>>>>>>> be cleaned
>>>>>>>>>>> W: Output path
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>> 
>>> /home/vy/Projects/log4j/3/log4j-layout-template-json/target/generated-sources/annotations
>>>>>>>>>>> intersects with a source root. Only files that were created by
>>>> build
>>>>>>>>> will
>>>>>>>>>>> be cleaned
>>>>>>>>>>> W: Output path
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>> 
>>> /home/vy/Projects/log4j/3/log4j-layout-jackson-json/target/generated-sources/annotations
>>>>>>>>>>> intersects with a source root. Only files that were created by
>>>> build
>>>>>>>>> will
>>>>>>>>>>> be cleaned
>>>>>>>>>>> W: Output path
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>> 
>>> /home/vy/Projects/log4j/3/log4j-core/target/generated-test-sources/test-annotations
>>>>>>>>>>> intersects with a source root. Only files that were created by
>>>> build
>>>>>>>>> will
>>>>>>>>>>> be cleaned
>>>>>>>>>>> 
>>>>>>>>>>> *E: Cannot build maven-annotations-production:log4j-api because
>>>> it is
>>>>>>>>>>> included into a circular dependency (module 'log4j-api'
>>>> production,
>>>>>>>>>>> maven-annotations-production:log4j-api, module 'log4j-plugins'
>>>>>>>>> production,
>>>>>>>>>>> maven-annotations-production:log4j-plugins)E: Cannot build
>>>>>>>>>>> maven-annotations-test:log4j-plugins because it is included
>>> into a
>>>>>>>>> circular
>>>>>>>>>>> dependency (maven-annotations-test:log4j-plugins, module
>>>> 'log4j-api'
>>>>>>>>> tests,
>>>>>>>>>>> maven-annotations-test:log4j-api, module 'log4j-plugins' tests)*
>>>>>>>>>>> 
>>>>>>>>>>> Did you get it working? What shall I do to make it work?
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
> 


Reply via email to