Differences between revisions 1 and 2
Revision 1 as of 2013-02-05 15:37:01
Size: 5089
Comment: imported content
Revision 2 as of 2014-08-27 14:25:04
Size: 1800
Comment: updated
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Introduction = = Working with Marmotta and Maven =
Line 3: Line 3:
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. At this page you would find some useful documentation for working with such Maven and Apache Marmotta.
Line 5: Line 5:
= Installation =  == Installation ==
Line 15: Line 15:
== Repository == == Working with Marmotta ==
Line 17: Line 17:
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 ==
=== Modifying a module ===
Line 47: Line 25:
Hot deployment of LMF Webapps is also supported using [JRebel]. Hot deployment is also supported using [[JRebel]].
Line 49: Line 27:
== Testing == === Testing ===
Line 57: Line 35:
== Check test coverage == === Check test coverage ===
Line 68: Line 46:
== Build the site == === Build the site ===
Line 80: Line 58:
= 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 =
== IDE Integration ==
Line 192: Line 66:
= Additional documentation = === Additional documentation ===
Line 194: Line 68:
== Cleaning LMF home directory == == Cleaning Marmotta home directory ==
Line 196: Line 70:
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: Any Marmotta webapp comes with a Maven profile that allows you to clean the folder that Marmotta uses to store some caches. For doing that you'd need to run:

Working with Marmotta and Maven

At this page you would find some useful documentation for working with such Maven and Apache Marmotta.

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*.

Working with Marmotta

Modifying a module

Just install it in your local repository:

mvn clean install

Hot deployment 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

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 Marmotta home directory

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

mvn clean -Pcleanall

Maven (last edited 2014-08-27 14:25:04 by SergioFernandez)