Wiki
Clone wikilmf / Maven
LMF building with Maven
Introduction
LMF switched from Gradle to 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, 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>
Artifacts installation
Just run:
mvn install
In you want to do it quicker, you can avoid running tests:
mvn install -DskipTests -Dmaven.test.skip=true
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 [## Testing
mvn test
@@TODO@@
Check test coverage
Using http://cobertura.sourceforge.net/ Cobertura you can perform difference check the percentage of code accessed by tests:
cobertura:check
Further details at the Cobertura Maven plugin.
Build a WAR
You can build the full LMF webapp in your JavaEE container executing:
cd lmf-webapp mvn package
You would get a target/LMF.war
file.
For deploying it in Tomcat, for instance, please take a look to the necessary settings.
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 \ -DarchetypeVersion=2.6.0 \ -DarchetypeRepository=http://devel.kiwi-project.eu:8080/nexus/content/repositories/releases/
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 \ -DarchetypeArtifactId=lmf-archetype-webapp \ -DarchetypeGroupId=at.newmedialab.lmf \ -DarchetypeVersion=2.6.0 \ -DarchetypeRepository=http://devel.kiwi-project.eu:8080/nexus/content/repositories/releases/
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
Updated