Search code examples
mavenarchetypes

Specify modules in root pom with archetype


I'm generating a custom archetype that has 4 child modules. The problem is, when I define these 4 modules in the root pom.xml, using the following notation:

<modules>
    <module>${rootArtifactId}-client</module>
    <module>${rootArtifactId}-daemon</module>
    <module>${rootArtifactId}-impl</module>
    <module>${rootArtifactId}-war</module>
</modules> 

When i run a mvn install on the archetype, I get an error saying that the project doesn't contain the modules.

Any ideas?

Thanks.


Solution

  • update your pom as follow:

    <modules>
        <module>${project.artifactId}-client</module>
        <module>${project.artifactId}-daemon</module>
        <module>${project.artifactId}-impl</module>
        <module>${project.artifactId}-war</module>
    </modules>