Maven child module does not exist

I am new to Maven. I extracted a project from SVN from a client with the following structure:

projectName |--> pom.xml |--> jetty-wrapper |--> pom.xml |--> bin |--> pom.xml |--> projectName-common |--> pom.xml |--> bin |--> pom.xml |--> projectName-war |--> bin |--> pom.xml 

pom.xml right under the 'projectName' (pom above) creates three modules

 <modules> <module>projectName-common</module> <module>projectName-war</module> <module>jetty-wrapper</module> </modules> 

But when you run mvn clean install from the projectName folder, projectName displays the following error

 Child module [...]projectName\projectName-war\pom.xml of [...]projectName\pom.xml does not exist 

The question is: should there be a pom.xml file right under the projectName-war as is the case with other modules that my client might have forgotten to transfer to SVN?

+13
java maven
source share
4 answers

Question: should there be pom.xml right under the name projectName-war

Simply put, yes .

You already understood this trick, and since you did not provide the aka pom.xml project descriptor for maven, it will not be able to call the Name-war project with a valid child module.

There must be a pom.xml file in the projectName-war file, and it must have an artifact identifier that matches the name under the parent module declaration, i.e.

 <artifactId>projectName-war</artifactId> 
+7
source share
 Child module [...]projectName\projectName-war\pom.xml of [...]projectName\pom.xml does not exist 

If you get the above error when using mvn install from the command line (the same pom can work in eclipse), you should change your pom.xml a bit

Instead below:

 <modules> <module>../my-util</module> <module>../my-server</module> </modules> 

Follow the below (enclose in profilers):

 <profiles> <profile> <modules> <module>../my-util</module> <module>../my-server</module> </modules> </profile> </profiles> 
+27
source share

I renamed the project and child modules in eclipse and made the necessary changes in POM.xml, but then the folder name on the disk was the same as before. I had to rename the folder names and then delete the project on Eclipse and import it again to fix the problem ..

0
source share
 This issue usually comes when you copy and paste the child projects For example, We have individual child projects as below <artifactId>business-layer</artifactId> with project name as business-layer <artifactId>service-layer</artifactId> with project name as **xyz**-layer <modules> <module>business-layer</module> <module>**service-layer**</module> </modules> You project name during the initial build should be same as the module name. This need not require the <profiles> tag to be added as the purpose of profiles tag is to trigger builds with specific actions 
0
source share

All Articles