js-generator icon indicating copy to clipboard operation
js-generator copied to clipboard

Run Individual test inside Intellij Idea

Open FanJups opened this issue 1 year ago • 4 comments

Given the multi-module nature of this project, Intellij Testing always fails. Fortunately, running tests at the command line works but we should also be able to run test inside Intellij

After running tests in Intellij, most of the time we get this error java: module not found: com.osscameroon.jsgenerator.core

Then, what if we deploy core module to maven/gradle ? Maybe, this error will disappear ? Or, is there a way to prevent Intellij to first search this module on maven central but start by checking locally ?

https://www.google.com/search?q=intellij+idea+failing+to+run+test+in+module+project&sca_esv=984db0dce26ae1a8&rlz=1C1FCXM_pt-PTPT1032PT1032&sxsrf=ADLYWIKa6aHpYXdAHsrIKOQDRDxKUgv7dg%3A1728935202287&ei=InUNZ5-bEciK7M8Ps7uAoAI&ved=0ahUKEwiftMnE0Y6JAxVIBfsDHbMdACQQ4dUDCA8&uact=5&oq=intellij+idea+failing+to+run+test+in+module+project&gs_lp=Egxnd3Mtd2l6LXNlcnAiM2ludGVsbGlqIGlkZWEgZmFpbGluZyB0byBydW4gdGVzdCBpbiBtb2R1bGUgcHJvamVjdDIFECEYnwVIyjdQ7QNY_TNwAXgBkAEAmAGjAaABjBOqAQQwLjE4uAEDyAEA-AEBmAIToALFE8ICChAAGLADGNYEGEfCAgcQIRigARgKwgIEECEYFZgDAIgGAZAGCJIHBDEuMTigB6Vp&sclient=gws-wiz-serp

FanJups avatar Oct 14 '24 21:10 FanJups

https://www.google.com/search?q=how+to+successfully+run+test+of+maven+multi+module+project+intellij&rlz=1C1FCXM_pt-PTPT1032PT1032&oq=how+to+successfully+run+test+of+maven+multi+module+project&gs_lcrp=EgZjaHJvbWUqBwgBECEYoAEyBggAEEUYOTIHCAEQIRigATIHCAIQIRiPAjIHCAMQIRiPAtIBCTMzODMzajBqN6gCALACAA&sourceid=chrome&ie=UTF-8

FanJups avatar Oct 14 '24 21:10 FanJups

https://stackoverflow.com/questions/63232081/running-tests-in-a-maven-multi-module-project

FanJups avatar Oct 14 '24 21:10 FanJups

https://github.com/mesche/maven-multi-project-example

FanJups avatar Oct 14 '24 21:10 FanJups

Looks like it is linked to Intellij Test Config because I succeeded to run individual test by CLI

mvn -Dtest=ConverterTest#comparisonBetweenJsGeneratorAndOtherConverters test

I was running maven inside and outside Intellij then this error occured

[ERROR] Failed to execute goal on project jsgenerator-test-core: Could not collect dependencies for project com.osscameroon:jsgenerator-test-core:jar:0.0.1-SNAPSHOT [ERROR] java.lang.IllegalArgumentException: Invalid Version Range Request: com.osscameroon:jsgenerator:pom:${revision} < [central (https://repo.maven.apache.org/maven2, default, releases)] [ERROR] Caused by: Invalid Version Range Request: com.osscameroon:jsgenerator:pom:${revision} < [central (https://repo.maven.apache.org/maven2, default, releases)]

I solve the problem with this command: mvn clean dependency:resolve

FanJups avatar Oct 20 '25 07:10 FanJups

@Kurocifer , please try to transform this project to not use java module system. Maybe, that's the solution

FanJups avatar Nov 17 '25 21:11 FanJups