自定义演示未加载到Magnolia CMS

时间:2016-04-21 14:54:00

标签: magnolia

我已关注Travel Demo - for developers并设法启动Travel Demo。现在我正在尝试在magnolia-travel-tours上自定义模板(ftl)。

我注意到,模板的更改未被提取。看起来,因为当我作为依赖于我的网络应用程序时,我没有指定版本号,所以当我构建Magnolia Web App时,正在下载Demo的新副本。 这是我放置依赖的方式,

<?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>
    <parent>
        <groupId>com.esharps.projects</groupId>
        <artifactId>coreCMSProject</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>coreCMSProject-webapp</artifactId>
    <name>coreCMSProject: webapp</name>
    <packaging>war</packaging>
    <dependencies>
        <dependency>
            <groupId>info.magnolia</groupId>
            <artifactId>magnolia-empty-webapp</artifactId>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>info.magnolia</groupId>
            <artifactId>magnolia-empty-webapp</artifactId>
            <type>war</type>
        </dependency>
        <dependency>
            <groupId>info.magnolia.demo</groupId>
            <artifactId>magnolia-travel-tours</artifactId>
        </dependency>

如果我的理解错误,请纠正我。

现在我所做的是,我为玉兰旅行团提供了版本号和组ID,并重建了玉兰旅行团(必须指定玉兰旅行演示模块的版本号)并包括在内我的webapp上的特定版本

玉兰旅行团的pom.xml

<?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>
  <parent>
    <groupId>info.magnolia.demo</groupId>
    <artifactId>magnolia-travel-demo-parent</artifactId>
    <version>0.11-SNAPSHOT</version>
    <relativePath>../magnolia-travel-demo-parent/pom.xml</relativePath>
  </parent>
  **<groupId>info.magnolia.demo</groupId>**
  <artifactId>magnolia-travel-tours</artifactId>
  <packaging>jar</packaging>
  **<version>0.11-CUSTOM</version>**
  <name>Magnolia Travel Tours Module</name>
  <description>Magnolia module showcasing a travel-tours website</description>

  <properties>
    <cloverCoverageThreshold>37</cloverCoverageThreshold>
  </properties>

  <dependencies>
    <!-- Dependencies to travel-demo -->
    <dependency>
      <groupId>info.magnolia.demo</groupId>
      <artifactId>magnolia-travel-demo</artifactId>
      <version>**0.11-SNAPSHOT**</version>
    </dependency>

现在的问题是,当我尝试启动网络应用时,我遇到了以下错误。

2016-04-22 02:33:54,906 ERROR info.magnolia.init.MagnoliaServletContextListener : Oops, Magnolia could not be started
info.magnolia.module.model.reader.ModuleDependencyException: The following exceptions were found while checking Magnolia modules dependencies (i.e. those in META-INF/magnolia/my-module.xml):
Module Magnolia Travel Tours Module (version 0.11.0-CUSTOM) is dependent on travel-demo (version 0.11-CUSTOM), but Magnolia Travel Demo Module (version 0.10.0) is currently installed.
Module Magnolia Travel Tours Module (version 0.11.0-CUSTOM) is dependent on mtk (version 0.10/*), but Magnolia Templating Kit (version 0.9.0) is currently installed.
info.magnolia.module.model.reader.ModuleDependencyException: The following exceptions were found while checking Magnolia modules dependencies (i.e. those in META-INF/magnolia/my-module.xml):

我应该如何自定义旅行演示?

1 个答案:

答案 0 :(得分:1)

似乎您正在尝试自定义travel-demo而不更改您正在部署的Web应用程序中的依赖项。我假设您正在使用IDE。然后我会检查我想要部署的webapp,然后在它的pom中,我会改变旅行 - 演示依赖性,这将指向我的自定义旅行演示。你在这里的错误是导入了空的webapp,但是当时已经构建了它,所以当时你的修改没有被提取。

请看一下

      <!-- 1. Import dependency management from one of our parent poms (bundles or packs) -->
      <dependency>
        <!-- CE bundle -->
       <groupId>info.magnolia.bundle</groupId>
       <artifactId>magnolia-bundle-parent</artifactId>
        <version>${magnoliaVersion}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>

      <!-- 2. Own modules -->
      <dependency>
        <groupId>info.magnolia.dev</groupId>
        <artifactId>magnolia-dev-webapp</artifactId>
        <version>${project.version}</version>
      </dependency>

      <!-- 3. Version overrides for modules in this project -->
      <!--<dependency>-->
        <!--<groupId>info.magnolia.contacts</groupId>-->
        <!--<artifactId>magnolia-contacts</artifactId>-->
        <!--<version>${contactsVersion}</version>-->
      <!--</dependency>-->
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <!-- animal-sniffer doesn't support java 1.8 yet -->
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>animal-sniffer-maven-plugin</artifactId>
          <configuration>
            <skip>true</skip>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>

这个开发项目基本上包含一个可以部署的Web应用程序,您可以在那里更改任何依赖项。它被深入评论,因此与它合作是微不足道的。最后,你必须部署开发项目的战争。

干杯,