Apache Maven is a build tool like Apache Ant, but with a completely different approach to managing software builds: where Apache Ant is like a procedural programming language for describing how to build your system, Apache Maven is more of a fully-fledged assembly line for building, packaging, testing, and running software projects.
The Maven repository at http://repo.flexive.org/maven2/ contains all [fleXive] libraries with correct
dependencies set up. To use it in your Maven project, add the following repository
to your
pom.xml
:
<repository> <id>maven.flexive.org</id> <name>Flexive repo</name> <url>http://repo.flexive.org/maven2</url> <layout>default</layout> </repository>
The repository contains all released versions, including snapshots for all active branches that are updated from our internal continuous integration servers. Use these -SNAPSHOT revisions to use the latest features and bugfixes, but don't use them in a final product!
To resolve all dependencies of [fleXive], you also need to add the following repositories from java.net and JBoss:
<repository> <id>maven2-repository.dev.java.net</id> <name>Java.net Repository for Maven</name> <url>http://download.java.net/maven/2/</url> <layout>default</layout> <snapshots> <updatePolicy>never</updatePolicy> </snapshots> </repository> <repository> <id>maven2-jboss</id> <name>JBoss Maven Repository</name> <url>http://repository.jboss.org/maven2</url> <layout>default</layout> <snapshots> <updatePolicy>never</updatePolicy> </snapshots> </repository> <repository> <id>maven-dev-repository.dev.java.net</id> <name>Java.net Dev Repository for Maven</name> <url>https://maven-repository.dev.java.net/repository/</url> <layout>legacy</layout> <snapshots> <updatePolicy>never</updatePolicy> </snapshots> </repository>
Archetypes provide a quick start for new projects. Currently we offer a archetype for a full enterprise application with web and console frontends. Since the archetype includes setup scripts for the H2 database, it can be used without external dependencies like MySQL. However, for administration tasks such as database setup you currently have to use the tools provided by the [fleXive] distribution.
The archetypes are (as the rest of the Maven modules) still under development, so please report rough edges or missing features in our issue tracker.
The snapshot versions in our Maven repository (
3.0-SNAPSHOT
and
3.1-SNAPSHOT
)
are updated automatically from our internal Continuous Integration server (Hudson)
with the latest stable build of the corresponding branch. A build is considered
"stable" in this context when no testcase fails.
The snapshot versions are a convenient way of getting and testing the latest features,
however these builds are not tested manually and may cause all kinds of havoc
including data loss. If possible, it is recommended to use stable versions.
The archetype
flexive-archetype-ear
creates a multi-module enterprise application, which will be deployed as an EAR.
It also allows easy integration testing with OpenEJB and offers a standalone
webserver using Jetty and H2.
To get started, create a new project using the following command:
mvn archetype:generate -DarchetypeGroupId=com.flexive -DarchetypeArtifactId=flexive-archetype-ear -DarchetypeVersion=0.8 -DarchetypeRepository=http://repo.flexive.org/maven2/
This will prompt you for the artifact and group IDs and
create a new project in the current directory.
The [fleXive] version to be used can be specified in the main module's
pom.xml
file. By default, it is set to the current release required for all features
(currently this is
3.1.4
).
For a list of available versions, please look at the Maven repository
(e.g.
here).
The following commands (issued in the project directory) will walk you through the most important features:
Compile and package the application. The resulting EAR file can be deployed in any supported application server (for setup instructions, consult Chapter 2, Installing [fleXive]).
Compile, package and install the application. If executed for the first time,
the H2 database schemas will also be created in the
database/h2
subdirectory.
Compile, package and install the application. Manually activate the profile
db-setup-h2
to reset the H2 database in the
database/h2
subdirectory. (You can also force a reset of the H2 database by deleting the
database/h2
directory and running
mvn install.)
Start an instance of the Jetty WebServer to deploy our application (including the administration GUI) and OpenEJB. The available applications can be browsed at http://localhost:8080.
Additional information on working with the Maven archetypes can be found in the following blog entries:
Please note that some features are dependent on the [fleXive] version:
H2/OpenEJB/Jetty support is only available in 3.1 or later.
In order to build your project with [fleXive] 3.0.x, you have to disable the
database
and
consoleapp
modules in your root
pom.xml
.
Then you can package an EAR file using the
mvn package
command.
The archetype
flexive-archetype-war
provides a base for packaging a [fleXive] application for EJB 3.1-compatible
containers that support EJB deployment for WAR applications.
The resulting WAR runs also on JavaEE 6 web profile containers, as long as you don't define remote interfaces (or use other features that are missing in the web profile, such as message driven beans).
Currently the support is targeted on Glassfish 3+ (being the reference implementation for JavaEE 6), but no Glassfish-specific features are required. To create a new project:
mvn archetype:generate -DarchetypeGroupId=com.flexive -DarchetypeArtifactId=flexive-archetype-war -DarchetypeVersion=0.8 -DarchetypeRepository=http://repo.flexive.org/maven2/
Invoke mvn package to create the WAR file, and deploy it to the application server.
While you can browse all artifacts at http://repo.flexive.org/maven2/, the following list enumerates those you will most likely end up using in your application.
The [fleXive] EJB layer (packaging: ejb). Add this to your EAR module.
<dependency> <groupId>com.flexive</groupId> <artifactId>flexive-ejb</artifactId> <version>3.1.4</version> <type>ejb</type> </dependency>
The [fleXive] shared classes, including all EJB interfaces. Use this artifact in modules that need to access [fleXive] via EJB, but are not EJBs themselves (e.g. web modules).
<dependency> <groupId>com.flexive</groupId> <artifactId>flexive-shared</artifactId> <version>3.1.4</version> <type>jar</type> </dependency>
The [fleXive] administration GUI, including all required libraries and the actual WAR package.
<dependency> <groupId>com.flexive</groupId> <artifactId>flexive-backend</artifactId> <version>3.1.4</version> <type>jar</type> </dependency>
The JSF component library (includes flexive-web-shared).
<dependency> <groupId>com.flexive</groupId> <artifactId>flexive-plugin-jsf-core</artifactId> <version>3.1.4</version> <type>jar</type> </dependency>
Shared (framework agnostic) web classes, including authentication filters, servlets for delivering [fleXive] contents.
<dependency> <groupId>com.flexive</groupId> <artifactId>flexive-web-shared</artifactId> <version>3.1.4</version> <type>jar</type> </dependency>
Document extractors (e.g. for PDF files). Includes libraries to extract the text from a binary document format for full-text search and renderers for preview generation. Matching documents are stored as instances of the "Document" type.
<dependency> <groupId>com.flexive</groupId> <artifactId>flexive-extractor-documents</artifactId> <version>3.1.4</version> <type>jar</type> </dependency>
Audio extractors (e.g. for MP3 files). Extracts meta information like bitrate or album title from common audio file formats and stores it in the "Audio" document type.
<dependency> <groupId>com.flexive</groupId> <artifactId>flexive-extractor-audio</artifactId> <version>3.1.4</version> <type>jar</type> </dependency>