Introduction

LMF switched from [http://gradle.org/ Gradle] to [http://maven.apache.org/ Maven] as build system after the 2.4 release. At this page you would find some useful documentation for working with such tool and the Linked Media Framework.

= Installation =

First, [http://maven.apache.org/download.html download Maven] and follow the installation instructions. After that, type the following in a terminal or in a command prompt:

mvn --version

It should print out your installed version of Maven. *Maven 3.x is required*.

Repository

LMF artifacts are not available at main Maven repositories, so you'd need to add our repositories to your settings:

@@TODO@@

== Plugins Groups ===

The LMF artifacts use some plugins that are not under the default group, therefore for some tasks you may need to add some plugin groups to your ~/.m2/settings.xml file:

  <pluginGroups>
    ...
    <pluginGroup>org.apache.tomcat.maven</pluginGroup>
    <pluginGroup>org.mortbay.jetty</pluginGroup>
    <pluginGroup>org.phpmaven</pluginGroup>
    <pluginGroup>at.newmedialab.maven</pluginGroup>
  </pluginGroups>

Working with LMF

Modifying a module

Just install it in your local repository:

mvn clean install

Hot deployment of LMF Webapps is also supported using [JRebel].

Testing

mvn test

@@TODO@@

Check test coverage

Using Cobertura you can perform difference check the percentage of code accessed by tests:

cobertura:check

Further details at the Cobertura Maven plugin.

Build the site

mvn site

Alternative you can directly run it on a embeded server:

mvn site:run -Dport=8081

= Build your own applications based on LMF =

Build your own LMF Module

There is a Maven archetype for a LMF Module:

mvn archetype:generate \
   -DarchetypeGroupId=at.newmedialab.lmf \
   -DarchetypeArtifactId=lmf-archetype-module 

This will generate the following structure:

.
|-- pom.xml
`-- src
    `-- main
        |-- java
        `-- resources
            |-- kiwi-module.properties
            |-- META-INF
            |   `-- beans.xml
            `-- web
                `-- admin
                    |-- about.html
                    |-- configuration.html
                    `-- img
                        `-- clock_small.png

Build your webapp based on LMF

There is a Maven archetype for a LMF Webapp:

mvn archetype:generate \
   -DarchetypeGroupId=at.newmedialab.lmf \
   -DarchetypeArtifactId=lmf-archetype-webapp 

After that you will have a new Maven project with a structure like:

.
|-- pom.xml
`-- src
    |-- main
    |   |-- resources
    |   |   |-- default-config.properties
    |   |   |-- ehcache-db.xml
    |   |   |-- ehcache-lmf.xml
    |   |   |-- logback.xml
    |   |   `-- META-INF
    |   |       |-- beans.xml
    |   |       `-- persistence.xml
    |   `-- webapp
    |       |-- index.jsp
    |       |-- META-INF
    |       |   `-- jetty-web.xml
    |       |-- search
    |       |   `-- test_luke.html
    |       |-- skosjs-extension
    |       |   `-- test.html
    |       |-- solr
    |       |   |-- admin
    |       |   |-- favicon.ico
    |       |   `-- index.jsp
    |       `-- WEB-INF
    |           |-- jetty-web.xml
    |           |-- realm.properties
    |           |-- templates
    |           |   |-- 404.ftl
    |           |   |-- admin.ftl
    |           |   `-- rdfhtml.ftl
    |           `-- web.xml
    `-- test
        `-- resources
            |-- arquillian.xml
            |-- data
            |-- ehcache.xml
            |-- jndi.properties
            |-- logback.xml
            |-- META-INF
            |   |-- beans.xml
            |   `-- test-persistence.xml
            |-- test-config.properties
            `-- WEB-INF
                `-- test-web.xml

Then, moving to the folder that Maven created, you can start it just by running one of the following commands:

mvn jetty:run
mvn tomcat6:run
mvn tomcat7:run

By default it will start your new webapp at http://localhost:8080

Of course you could customize whatever you need.

IDE Integration

For the moment all the actions were performed form the command-line. But Maven is nicely supported by many IDEs:

Additional documentation

Cleaning LMF home directory

Any LMF webapp comes with a Maven profile that allows you to clean the folder that LMF uses to store some caches. For doing that you'd need to run:

mvn clean -Pcleanall

Maven (last edited 2013-02-05 15:37:01 by SergioFernandez)