部署为ROOT和SpringLoaded Hippo CMS

时间:2015-04-29 14:15:13

标签: maven tomcat cargo hippocms spring-loaded

Spring Loaded一直在为我工作正常,直到我最近切换到以root身份部署。 (完全摆脱我网站网址中的“/ site”)

我已经在这里修改了Jeroen提出的原始配置,但它无法正常工作。 (${project.basedir}/target/tomcat7x/webapps/ROOT下的文件未更新,网站指的是此过时的来源,而不是最新的${project.basedir}/site/target/ROOT

我错过了什么?

我的${project.basedir}/pom.xml

<profile>
  <id>cargo.run</id>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-tomcat-resources</id>
            <phase>validate</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/contexts</outputDirectory>
              <resources>
                <resource>
                  <directory>conf</directory>
                  <includes>
                    <include>*-context.xml</include>
                  </includes>
                  <filtering>true</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
          <artifactId>cargo-maven2-plugin</artifactId>
          <configuration>
            <configuration>
              <properties>
                <cargo.jvmargs>-Xmx1920m -Xdebug -Xrunjdwp:transport=dt_socket,address=${cargo.debug.address},server=y,suspend=${cargo.debug.suspend} -noverify -javaagent:/Users/eric/libs/springloaded.jar ${cargo.jvm.args}</cargo.jvmargs>
              </properties>
              <configfiles>
                <configfile>
                  <file>${project.build.directory}/contexts/site-context.xml</file>
                  <todir>conf/Catalina/localhost/</todir>
                  <tofile>site.xml</tofile>
                </configfile>
              </configfiles>
            </configuration>
          </configuration>
        </plugin>
      ...
    </plugins>
  </build>
</profile>

我的${project.basedir}/site/pom.xml

<finalName>ROOT</finalName>
...
<plugin>
        <groupId>com.googlecode.mavenfilesync</groupId>
        <artifactId>maven-filesync-plugin</artifactId>
        <configuration>
          <mappings>
            <mapping>
              <sourceFolder>src/main/resources</sourceFolder>
              <destinationFolder>@../target/tomcat${cargo.tomcat.major.version}x/webapps/site/WEB-INF/classes</destinationFolder>
            </mapping>
            <mapping>
              <sourceFolder>src/main/webapp</sourceFolder>
              <destinationFolder>@../target/tomcat${cargo.tomcat.major.version}x/webapps/site</destinationFolder>
            </mapping>
          </mappings>
        </configuration>
      </plugin>

${project.basedir}/conf/site-context.xml(我尝试将两个路径都作为空字符串和“/”并且都不起作用)

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/" docBase="${project.basedir}/site/target/ROOT">

    <Loader className="org.apache.catalina.loader.VirtualWebappLoader" searchVirtualFirst="true"
            virtualClasspath="${project.basedir}/site/target/classes" />

</Context>

1 个答案:

答案 0 :(得分:2)

由于您将已部署的应用程序重命名为ROOT,因此您可能还需要将site-context.xml的名称更改为ROOT.xml。根据{{​​3}},需要匹配战争文件名称。

<plugin>
  <groupId>org.codehaus.cargo</groupId>
  <artifactId>cargo-maven2-plugin</artifactId>
  <configuration>
    <configuration>
      <properties>
        <cargo.jvmargs>-Xmx1920m -Xdebug -Xrunjdwp:transport=dt_socket,address=${cargo.debug.address},server=y,suspend=${cargo.debug.suspend} -noverify -javaagent:/Users/eric/libs/springloaded.jar ${cargo.jvm.args}</cargo.jvmargs>
      </properties>
      <configfiles>
        <configfile>
          <file>${project.build.directory}/contexts/site-context.xml</file>
          <todir>conf/Catalina/localhost/</todir>
          <tofile>ROOT.xml</tofile>
        </configfile>
      </configfiles>
    </configuration>
  </configuration>
</plugin>