Uploaded image for project: 'Archetypes'
  1. Archetypes
  2. ARCH-62

Module archetype fails when supplying latest bundle version

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.2.4
    • None
    • None
    • None
    • Yes
    • Kromeriz 144

       

      If you create a "Module" with the magnolia archetypes and enter the version of the latest bundle (such as "5.6.3") to the "magnolia version" prompt, then the maven build will fail.

      (Originally reported here: https://documentation.magnolia-cms.com/display/DOCS56/Release+notes+for+Magnolia+CORE+5.6.3?focusedCommentId=156404514#comment-156404514)

      We should update module archetype to work when a user supplies the bundle version.

       

      The interactive UI should be clear which version is required:

      Define value for property 'magnolia-bundle-version':
      

      Maven pom

      So that the maven pom does not need to specify the magnolia module version, the maven pom should have the same dependency management as a project does. AKA:

       

            <!-- Option A -->
            <!-- Importing dependencyManagement of CE bundle. -->
            <dependency>
              <groupId>info.magnolia.bundle</groupId>
              <artifactId>magnolia-bundle-parent</artifactId>
              <version>${magnoliaBundleVersion}</version>
              <type>pom</type>
              <scope>import</scope>
            </dependency>      <!-- Option B -->
            <!-- If you want to use the Enterprise Edition. -->
            <!--
            <dependency>
              <groupId>info.magnolia.eebundle</groupId>
              <artifactId>magnolia-enterprise-bundle-parent</artifactId>
              <version>${magnoliaBundleVersion}</version>
              <type>pom</type>
              <scope>import</scope>
            </dependency>
            -->
      

       

       

      And, Remove the <version> from the dependency on magnolia-core. (Because it gets it from the above now.)

       

      Magnolia Module Descriptor [module].xml

      Change the core dependency to something like 1/* so that it will work with any main version by default.

       

      -------------------

      Previous Notes

      Currently when I create a new module using the archetype I get a dependency on core with a specific version. Now that Magnolia version can diverge from core version we should update the module archetype to reflect this. Further more, we need to stop hard coding version numbers into the descriptor file.

      (Or at the very least we need to update the archtype instructions to make it clear which magnolia version is required - and update our documentation)

      Example of a pom generated by the current archetype:

      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>info.magnolia.test</groupId>
        <artifactId>magnolia-test</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>
        <name>magnolia-test Magnolia Module</name>
        <!--
        <description>Please uncomment and fill in ...</description>
        -->
        <properties>
          <magnoliaVersion>5.6</magnoliaVersion>
          <javaVersion>1.8</javaVersion>
        </properties>
      
        <dependencies>
          <dependency>
            <groupId>info.magnolia</groupId>
            <artifactId>magnolia-core</artifactId>
            <version>${magnoliaVersion}</version>
          </dependency>
          <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
          </dependency>
      
          <!-- TEST -->
          <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
          </dependency>
        </dependencies>
      
        <build>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>2.3.2</version>
              <configuration>
                <source>${javaVersion}</source>
                <target>${javaVersion}</target>
              </configuration>
            </plugin>
          </plugins>
      
          <!-- default resources configuration which will filter the module descriptor -->
          <resources>
            <resource>
              <directory>src/main/resources</directory>
              <includes>
                <include>**/*</include>
              </includes>
            </resource>
            <resource>
              <filtering>true</filtering>
              <directory>src/main/resources</directory>
              <includes>
                <include>META-INF/magnolia/*</include>
              </includes>
            </resource>
          </resources>
        </build>
      
        <repositories>
          <repository>
            <id>magnolia.public</id>
            <url>https://nexus.magnolia-cms.com/content/groups/public</url>
            <snapshots>
              <enabled>true</enabled>
            </snapshots>
          </repository>
          <!-- IF YOU NEED MODULES FROM THE ENTERPRISE VERSION, UNCOMMENT THE FOLLOWING REPOSITORY -->
          <!--
          <repository>
            <id>magnolia.enterprise.releases</id>
            <url>https://nexus.magnolia-cms.com/content/repositories/magnolia.enterprise.releases</url>
            <snapshots>
              <enabled>false</enabled>
            </snapshots>
          </repository>
          -->
          <repository>
            <id>vaadin-addons</id>
            <url>https://maven.vaadin.com/vaadin-addons</url>
          </repository>
        </repositories>
      
      </project>
      

      Example of a descriptor generated by the current archetype:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE module SYSTEM "module.dtd" >
      <module>
        <name>magnolia-test</name>
        <displayName>${project.name}</displayName>
        <description>${project.description}</description>
        <class&amp;amp;amp;amp;amp;amp;amp;amp;gt;info.magnolia.test.TestModule</class&amp;amp;amp;amp;amp;amp;amp;amp;gt;
        <versionHandler>info.magnolia.test.setup.TestModuleVersionHandler</versionHandler>
        <version>${project.version}</version>
      
        <dependencies>
          <dependency>
            <name>core</name>
            <version>5.6/*</version>
          </dependency>
          <!--  Add other dependencies here, e.g the mte (magnolia templating essentials).
          <dependency>
            <name>mte</name>
            <version>0.7/*</version>
          </dependency>
          -->
        </dependencies>
      </module>
      

        Acceptance criteria

              rsiska Robert Šiška
              czimmermann Christopher Zimmermann
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD