1

It has been working lovely for me until yesterday. I'm using it with SpringLoaded in my Hippo CMS project.

Symptoms:
- Works for changes to .ftl files - Does not work for changes to java classes e.g. MyContactFormComponent

Some findings:

  • The latest change is reflected in the class file under /site/target/classes/ and /site/target/site/WEB-INF/classes
  • The latest change is NOT reflected in the class file under /target/tomcat7x/webapps/site.war (I extracted it) ==> Cargo and Tomcat are using /target/tomcat7x/webapps/site.war instead of /site/target/classes/. This contradicts the intended SpringLoaded setup!

The question is why it happened all out of a sudden?

Note that there is no exception or error whatsoever!

One of the thing I did yesterday was to increase memory for JVM under Cargo settings:

<cargo.jvmargs>-Xmx1920m</cargo.jvmargs>  

This is because my repository is huge and I wouldn't be able to run the site without giving Java more memory. Could this be the culprit?

Maven log (mvn verify inside /site/ directory):

➜  site git:(master) ✗ mvn verify
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building SCC Site 2.01.34-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.2:create (default) @ scc-site ---
[INFO] Checking for local modifications: skipped.
[INFO] Updating project files from SCM: skipped.
[INFO] Executing: /bin/sh -c cd /Users/eric/hippo/scc2/site && svn --non-interactive info
[INFO] Working directory: /Users/eric/hippo/scc2/site
[INFO] Storing buildNumber: -1 at timestamp: 1429636391442
[INFO] Executing: /bin/sh -c cd /Users/eric/hippo/scc2/site && svn --non-interactive info
[INFO] Working directory: /Users/eric/hippo/scc2/site
[INFO] Storing buildScmBranch: UNKNOWN_BRANCH
[INFO] 
[INFO] --- maven-filesync-plugin:1.0.0:generate (default) @ scc-site ---
[INFO] No Eclipse .project file found. First import the maven project in Eclipse.
[INFO] 
[INFO] --- maven-remote-resources-plugin:1.5:process (default) @ scc-site ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ scc-site ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 7 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ scc-site ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 48 source files to /Users/eric/hippo/scc2/site/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ scc-site ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ scc-site ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ scc-site ---
[INFO] 
[INFO] --- maven-war-plugin:2.4:war (default-war) @ scc-site ---
[INFO] Packaging webapp
[INFO] Assembling webapp [scc-site] in [/Users/eric/hippo/scc2/site/target/site]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/eric/hippo/scc2/site/src/main/webapp]
[INFO] Webapp assembled in [3505 msecs]
[INFO] Building war: /Users/eric/hippo/scc2/site/target/site.war
[INFO] 
[INFO] --- maven-source-plugin:2.2.1:jar-no-fork (attach-sources) @ scc-site ---
[INFO] Building jar: /Users/eric/hippo/scc2/site/target/site-sources.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.229 s
[INFO] Finished at: 2015-04-22T01:13:28+08:00
[INFO] Final Memory: 20M/215M
[INFO] ------------------------------------------------------------------------

My main 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>org.onehippo.cms7</groupId>
        <artifactId>hippo-cms7-release</artifactId>
        <version>7.9.6</version>
    </parent>

    <name>SCC</name>
    <description>SCC</description>
    <groupId>com.abc</groupId>
    <artifactId>scc</artifactId>
    <version>2.01.34-SNAPSHOT</version>
    <packaging>pom</packaging>

    <!--
      The below project elements are emptied/overridden as otherwise their metadata would be
      inherited or merged from the parent hippo-cms7-release pom (or its hippo-cms7-project pom).

      DO NOT remove these tags but instead fill them in appropriately as needed,
      UNLESS the inherited values are valid for your project.
    -->
    <url/>
    <inceptionYear/>
    <organization/>
    <licenses>
        <license/>
    </licenses>
    <mailingLists>
        <mailingList/>
    </mailingLists>
    <developers>
        <developer/>
    </developers>
    <contributors>
        <contributor/>
    </contributors>
    <issueManagement/>
    <!--
    <scm>
      <connection/>
      <developerConnection/>
      <url/>
    </scm>
    -->
    <ciManagement/>

    <!-- End of emptied/overridden metadata from parent hippo-cms7-release pom. -->

    <properties>

        <!--***START temporary override of versions*** -->
        <hippo.cms.version>2.26.13</hippo.cms.version>
        <!-- ***END temporary override of versions*** -->
        <hippo.hst.version>2.28.09</hippo.hst.version>

        <essentials.version>1.02.06</essentials.version>
        <jsp-api.version>2.1</jsp-api.version>
        <jstl.version>1.1.2</jstl.version>
        <taglibs.version>1.1.2</taglibs.version>
        <commons.lang.version>2.6</commons.lang.version>
        <junit.version>4.10</junit.version>
        <easymock.version>3.1</easymock.version>

        <filesync.override>false</filesync.override>
        <maven.plugins.filesync.version>1.0.0</maven.plugins.filesync.version>
        <repo.bootstrap>true</repo.bootstrap>

    </properties>

    <repositories>
        <repository>
            <id>hippo</id>
            <name>Hippo maven 2 repository.</name>
            <url>https://maven.onehippo.com/maven2/</url>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.onehippo.cms7.essentials.sdk</groupId>
                <artifactId>api</artifactId>
                <version>${essentials.version}</version>
            </dependency>
            <dependency>
                <groupId>org.onehippo.cms7.essentials.components</groupId>
                <artifactId>cms</artifactId>
                <version>${essentials.version}</version>
            </dependency>
            <dependency>
                <groupId>org.onehippo.cms7.essentials.components</groupId>
                <artifactId>hst</artifactId>
                <version>${essentials.version}</version>
            </dependency>

            <!-- other predefined runtime scope versioned dependencies -->
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <version>${jstl.version}</version>
                <scope>runtime</scope>
            </dependency>

            <dependency>
                <groupId>taglibs</groupId>
                <artifactId>standard</artifactId>
                <version>${taglibs.version}</version>
                <scope>runtime</scope>
            </dependency>

            <!-- other predefined compile scope versioned dependencies -->
            <dependency>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
                <version>${commons.lang.version}</version>
            </dependency>

            <dependency>
                <groupId>org.freemarker</groupId>
                <artifactId>freemarker</artifactId>
                <version>${freemarker.version}</version>
            </dependency>

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.easymock</groupId>
                <artifactId>easymock</artifactId>
                <version>${easymock.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.easymock</groupId>
                <artifactId>easymockclassextension</artifactId>
                <version>2.5.2</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>cglib</groupId>
                        <artifactId>cglib-nodep</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.onehippo.cms7.hst</groupId>
                <artifactId>hst-mock</artifactId>
                <version>${hippo.hst.version}</version>
                <scope>test</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>
    <dependencies>
        <!--<dependency>-->
        <!--<groupId>mysql</groupId>-->
        <!--<artifactId>mysql-connector-java</artifactId>-->
        <!--<version>5.1.30</version>-->
        <!--<scope>provided</scope>-->
        <!--</dependency>-->
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <excludes>
                    <exclude>twbs</exclude>
                </excludes>
            </resource>
        </resources>
        <defaultGoal>package</defaultGoal>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.googlecode.mavenfilesync</groupId>
                    <artifactId>maven-filesync-plugin</artifactId>
                    <version>${maven.plugins.filesync.version}</version>
                    <configuration>
                        <override>${filesync.override}</override>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>${maven.plugin.buildnumber.version}</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <doCheck>false</doCheck>
                    <doUpdate>false</doUpdate>
                    <revisionOnScmFailure>-1</revisionOnScmFailure>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven.plugin.jar.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Build>${buildNumber}</Implementation-Build>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

        </plugins>
        <extensions>
            <!-- Enabling the use of SSH -->
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh-external</artifactId>
                <version>1.0-beta-6</version>
            </extension>
        </extensions>
    </build>

    <profiles>

        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>jrebel</name>
                </property>
            </activation>
            <modules>
                <module>bootstrap</module>
                <module>cms</module>
                <module>site</module>
                <module>essentials</module>
            </modules>
        </profile>

        <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>
                                    <catalina.servlet.uriencoding>UTF-8</catalina.servlet.uriencoding>
                                    <cargo.jvmargs>-Xmx1920m</cargo.jvmargs>
                                </properties>
                                <configfiles>
                                    <!--<configfile>-->
                                    <!--<file>${project.basedir}/conf/context.xml</file>-->
                                    <!--<todir>conf/</todir>-->
                                    <!--<tofile>context.xml</tofile>-->
                                    <!--</configfile>-->
                                    <configfile>
                                        <file>${project.build.directory}/contexts/site-context.xml</file>
                                        <todir>conf/Catalina/localhost/</todir>
                                        <tofile>site.xml</tofile>
                                    </configfile>
                                </configfiles>
                            </configuration>
                            <deployables>
                                <deployable>
                                    <type>war</type>
                                    <properties>
                                        <context>/cms</context>
                                    </properties>
                                    <location>${project.basedir}/cms/target/cms.war</location>
                                </deployable>
                                <deployable>
                                    <location>${project.basedir}/site/target/site.war</location>
                                    <type>war</type>
                                    <properties>
                                        <context>/site</context>
                                    </properties>
                                </deployable>
                                <deployable>
                                    <location>${project.basedir}/essentials/target/essentials.war</location>
                                    <type>war</type>
                                    <properties>
                                        <context>/essentials</context>
                                    </properties>
                                </deployable>
                            </deployables>
                            <container>
                                <systemProperties>
                                    <derby.stream.error.file>${project.basedir}/target/derby.log
                                    </derby.stream.error.file>
                                    <log4j.configuration>file:${project.basedir}/conf/log4j-dev.xml
                                    </log4j.configuration>
                                    <rebel.log4j-plugin>true</rebel.log4j-plugin>
                                    <!-- enables auto export: -->
                                    <project.basedir>${project.basedir}</project.basedir>
                                    <!--<repo.config>file:${project.basedir}/conf/repository.xml</repo.config>-->
                                </systemProperties>
                                <!--<dependencies>-->
                                <!--<dependency>-->
                                <!--<groupId>mysql</groupId>-->
                                <!--<artifactId>mysql-connector-java</artifactId>-->
                                <!--<classpath>extra</classpath>-->
                                <!--</dependency>-->
                                <!--</dependencies>-->
                            </container>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>dist</id>
            <dependencies>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>jcl-over-slf4j</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <build>
                <defaultGoal>validate</defaultGoal>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>distro-assembly</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>${project.basedir}/src/main/assembly/distribution.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>springloaded</id>
            <activation>
                <property>
                    <name>springloaded</name>
                </property>
            </activation>
            <properties>
                <javaagent>-javaagent:/Users/eric/libs/springloaded.jar</javaagent>
            </properties>
        </profile>

    </profiles>

</project>
1
  • 1
    What has changed since yesterday? If you did not change any configuration it should just work.
    – Jeroen
    Apr 28, 2015 at 8:06

1 Answer 1

0

Turned out the cargo.jvmargs broke it. It seems the javaagent SpringLoaded is disregarded this way.

So I made the following changes to ${project.basedir}/pom.xml and SpringLoaded works again:

<properties>
    <javaagent>-javaagent:/Users/eric/libs/springloaded.jar</javaagent>
</properties>
...
<profiles>
    <profile>
        <id>cargo.run</id>
        <build>
            <plugins>
                <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} ${cargo.jvm.args}</cargo.jvmargs> 

Without the complete jvmargs, Debug stops working as well.

The above is mentioned in Hippo CMS documentation too. I just had to dig it up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.