Apache Maven Cargo deploy with Tomcat 7

Following the post about Deploy to Tomcat 6 using #Maven, here is a ready to use example with the main differences explained in the table below

 Tomcat 7Tomcat 6
containerId<containerId>tomcat7x</containerId><containerId>tomcat6x</containerId>
Url of Tomcat manager<cargo.remote.uri><cargo.tomcat.manager.url>
examplehttp://host..com/manager/text/http://host..com/manager/
tomcat-users.xml

<tomcat-users>
<role rolename=”manager-gui”/>
<role rolename=”manager-script”/>
<role rolename=”manager-jmx”/>
<role rolename=”manager-status”/>
<user username=”admin” password=”admin” roles=”manager-gui,manager-script”/>
</tomcat-users>

<tomcat-users>
  <role rolename=”manager”/>
  <user username=”admin” password=”admin” roles=”manager”/>
</tomcat-users>

And finally a snippet of an Apache #Maven pom.xml ready to use in a profile, so you can reuse this profile like a method call

<profile>
    <id>deployTomcat</id>
    <activation>
        <activeByDefault>false</activeByDefault>
    </activation>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.1.0</version>
                <configuration>
                    <wait>true</wait>
                    <container>
                        <containerId>tomcat7x</containerId>
                        <type>remote</type>
                    </container>
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.remote.uri>${tomcat.url}</cargo.remote.uri>
                            <cargo.remote.username>${tomcat.user}</cargo.remote.username>
                            <cargo.remote.password>${tomcat.pwd}</cargo.remote.password>
                        </properties>
                    </configuration>
                    <deployer>
                        <type>remote</type>
                        <deployables>
                            <deployable>
                                <groupId>${deploy.groupid}</groupId>
                                <artifactId>${deploy.artifactid}</artifactId>
                                <type>war</type>
                                <properties>
                                    <context>${deploy.context}</context>
                                </properties>
                            </deployable>
                        </deployables>
                    </deployer>
                </configuration>
                <executions>
                    <execution>
                        <id>verify-deploy</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>deployer-undeploy</goal>
                            <goal>deployer-deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</profile>

Place as many profiles as you have machine to deploy in settings.xml and declare some variables as properties, as shown below:

<profile>
    <id>serverA</id>
    <activation>
        <activeByDefault>false</activeByDefault>
    </activation>
    <properties>
        <tomcat.url>http://host.com/manager/text</tomcat.url>
        <tomcat.user>admin</tomcat.user>
        <tomcat.pwd>admin
        </tomcat.pwd> 
        <!-- these properties must be defined as system property or -D --> 
        <!-- - deployable.artifactid: artifactId of web application to be deployed --> 
        <!-- - deployable.context: web context name -->
    </properties>
</profile>

So you can run, and target multiple host by just exchanging the name of the profile serverA to something else.

mvn integration-test –PdeployTomcat,serverA –Ddeployable.artifactid=demo -Ddeploy.groupid=com.mycompany –Ddeployable.context=showcase

When using Maven jetty:run, CSS and JavaScript files are never updated

I was getting mad because jetty was refusing to redeploy my static files (xhtml, css) in #Eclipse until I find the reason

The Jetty Web Server provides a HTTP server and Servlet container capable of serving static and dynamic contend either from a standalone or embedded instantiations.

Jetty buffers static content for webapps such as html files, css files, images etc and uses memory mapped files to do this if the NIO connectors are being used. The problem is that on Windows, memory mapping a file causes the file to be locked, so that the file cannot be updated or replaced. This means that effectively you have to stop Jetty in order to update a file.

To fix this, add a line with to your #maven-jetty-plugin configuration:

org.mortbay.jetty  maven-jetty-plugin  6.1.5       ...    src/main/resources/webdefault.xml     

The default webdefault.xml file is found in the lib/jetty.jar at org/mortbay/jetty/webapp/webdefault.xml. Extract it to a convenient disk location and edit it to change useFileMappedBuffer to false:

      useFileMappedBuffer       false     

Copy the changed file into src/main/resources/ of your project.

The problem is explained more in Jetty’s documentation.

Google’s PageRank Explained!

Ever want to know how Google assigned a pagerank to internet page?

  1. Google’s PageRank Explained!
  2. Google’s PageRank calculator!

I am currently writing my own module for #Joomla to display the Google’s pagerank of my page (PHP). When I was experimenting the code I found the following concerning my site:

  • www.waltercedric.com has a Google pagerank of 4/10… while
  • waltercedric.com has a Google pagerank of 3/10…

So i’ve made a big mess one more time by publishing incorrectly my site 😦

Brushless Heaven of Gensmantel

Bought on eBay, February 2002

Equippment

  • Motor: Brushless Kontronics (290€)
  • Controller: Kontronics regler (90€)
  • Gyro: CSM 180
  • RX: Robbe R600
  • Pitch/Roll/Nick-Servo: Prafa ps101/Prafa ps101/Prafa ps101
  • Tail-Servo: Prafa ps101
  • Battery: 12 x 2000 mAh NiCd Sanyo RC 2000
  • Blades: quick uk CFK blades
  • Weight empty: with canopy (gr) and blades (gr)
  • Weight in flight: with canopy and
  • Flight time:
  • Others: Aluso Rotor Head (193€),
  • Aluso swashplatte (101€),
  • Aluso Bell paddle (36€)
  • Main body made of GFK,
  • Tail boom, tails fins (229€),
  • main blade CFK (75€)

Zoom on Aluso rotor head

Gallery

[ngg src=”galleries” ids=”6″ display=”basic_thumbnail” thumbnail_crop=”0″ show_slideshow_link=”1″]

Flight log

24.02.2002

Setting up heli, not an easy task at all, because it is the first time that i set up a CCPM helicopter. You can can find an help at www.jason.net/ where the complete setup is explained.
Since this helicopter is a 12 cells, i can use the 6 battery from my eRaptor (24 x 12 RC2000 + 4 x 12 RC2400), cool !