Uploaded image for project: 'Maven Archetype'
  1. Maven Archetype
  2. ARCHETYPE-571

Unable to generate project which has pom with multiple profiles with modules section

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.1.1
    • 3.1.2
    • Archetypes, Plugin
    • None

    Description

      The archetype plugin does not allow multiple </modules> sections in project's pom, even if each </modules> section is in different <profile> section.

       

      I get this error

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.1.1:generate (default-cli) on project standalone-pom: Illegal to use multiple <modules/> sections.

       when I try to generate a project which has multiple profiles with modules sections in pom as follows. Having multiple profiles helps to build specific modules in specific profiles.

      <profiles>
      	<profile>
      		<id>profile1</id>
      		<modules>
      			<module>module1</module>
      		</modules>
      		</profile>
      	<profile>
      		<id>profile2</id>
      		<modules>
      			<module>module2</module>
      		</modules>
      		</profile>
      </profiles>
      

       

      tibordigana Looks like PomUtils.java does not consider possibility of multiple profiles while checking for multiple </modules> sections.
      https://github.com/apache/maven-archetype/blob/6ee16590590c722b6e7112edb470cf275106f53f/archetype-common/src/main/java/org/apache/maven/archetype/common/util/PomUtils.java

       

      Please review. Thanks!

      Attachments

        Activity

          People

            tibordigana Tibor Digana
            sdalvi Sneha Dalvi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: