Starting the Maven project

We are now going to create a Maven project which will contain our SU and SA projects.

Creating the Maven project

We start by creating an empty directory to hold the project. For this move to your development folder and create a folder.
(for example "http-uploader")

Next, move into this folder and create a pom.xml file that contains the common definitions for the entire project.
For now, just create a pom.xml that looks like this.

pom.xml
<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
  <modelVersion>4.0.0</modelVersion> 
  <groupId>org.apache.servicemix.examples</groupId> 
  <artifactId>http-example</artifactId> 
  <version>1.0-SNAPSHOT</version> 
  <packaging>pom</packaging> 
  <name>Simple HTTP Upload example</name> 
  <url>http://www.servicemix.org</url> 
</project> 

Checking the pom.xml

The easiest way to check the pom.xml, is by running Maven from the project directory:

mvn clean install

If the pom.xml is valid, Maven will copy it to your local repository and report a succesfull build.

[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------------------------
[INFO] Building Simple HTTP Upload example
[INFO]    task-segment: [clean, install]
[INFO] ----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory /home/lhe/example/target
[INFO] Deleting directory /home/lhe/example/target/classes
[INFO] Deleting directory /home/lhe/example/target/test-classes
[INFO] Deleting directory /home/lhe/example/target/site
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing /home/lhe/example/pom.xml to /home/lhe/.m2/repository/org/apache/servicemix/examples/http-example/1.0-SNAPSHOT/http-example-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Nov 28 09:47:59 CET 2007
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------

Next, we are going to create our first SU in this project.

Proceed to the next step



  • No labels