New a Project then new a module, the Project's resources file can't read.

Answered

Hello

I new a project and import log4j2.xml and its dependency, execute the Client.java print out by log4j , everything are normal.

Then I new a module, execute the Client.java again, error is coming.

It shows the sources log4j2.xml is not effect. And I found classes log4j2.xml is missing.

How can I fix it?What's the right way to make the resources effect?

 

0
7 comments

Hi Serge Baranov

I have use https://uploads.services.jetbrains.com/  upload the project names:

Jdk11_Lee_Mvn_20181120.tar.gz


0

Your Maven project is configured for the test2 module only.

If you want a proper Maven multi-module project, you will need to define the parent pom.xml and 2 child pom.xml files for each sub-project.

See https://books.sonatype.com/mvnex-book/reference/multimodule.html for the example.

Right now your command line Maven build will not build anything except test2.

0

I know, I will try it from your advise, thank you Serge~~~

0

But I found the question is also exist if I do like this:

I delete the module test2, remove the dependency in project test1 pom.xml.

Now it looks like my first step(New the project),but when I try to execute the java to print out sth, it also tell me "no find the log4j2.xml" like the second picture.

How should I do? I think maybe it's no relation to maven , maybe sth I should config?

0

Try setting the packaging to jar instead of pom: 

<packaging>jar</packaging>
0

OMG, you are right, it works, i'm sorry for my poor maven knowledge

Thank you Serge 

0

Please sign in to leave a comment.