Maven Documentation Home
Installation
Get Maven from
http://maven.apache.org/download.html and follow the installation instructions at the bottom of the page.
Configuration
Maven's backend is its repository
http://repo1.maven.org. The
Human Readable Interface is here:
http://mvnrepository.com/. You can get nearly all commonly used java libraries there. However for our development we need our own repository. In order to tell Maven how to use it, change either:
- Windows;
mavendir/conf/settings.xml
- Linux
~/.m2/settings.xml
Show file... Hide file!
<?xml version="1.0"?>
<settings>
<profiles>
<profile>
<id>52n-start</id>
<repositories>
<repository>
<id>n52-releases</id>
<name>52n Releases</name>
<url>http://52north.org/maven/repo/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>n52-snapshots</id>
<name>52n Snapshots</name>
<url>http://52north.org/maven/repo/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>apache</id>
<name>apache Releases</name>
<url>http://people.apache.org/repo/m2-snapshot-repository/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>52n-start</activeProfile>
</activeProfiles>
<!-- this is an example configuration for the apache tomcat server -->
<servers>
<server>
<id>wnsserver</id>
<username>admin</username>
<password>tomcat</password>
</server>
</servers>
</settings>
Using Maven
Checking out a project
Check out the project you want into a local directory (this directory
must not be an eclipse workspace!)

Please take a look at the
52°North portal, because the location of the
svn repositories has changed (
more information...).

|
Please incorborate the instructions into this page
Take a look for the
walkthrough for Linux (adaptable for Windows as well).
Please remind, for the WPS software you'll need additional repositories. Take a look
here (under "Installation of the service (CVS and maven instructions)").
After dowloading the files from the remote repository you can continue with loading the dependencies and optionally integrate you local copy into eclipse.
Installing in local repository
Installing into your local maven-repository means that maven downloads all dependencies from remote repositories into its local cache.
Furthermore Maven complies your local sourcecode and creates packages in your local maven-repository.
You can skip this step if it fails and you just want to get the project into eclipse.
mvn install
Deploying to the remote repository
Deploying into the remote 52North repository is only needed if you want to share libraries with other projects or you want to upload something for your team that is not in you shared repository.
For more instruction have a look here:
http://52north.org/twiki/bin/view/Internals/MavenDeploymentInfos
Maven and Eclipse
Maven can automatically create eclipse project files. Additionally maven creates links from your local repository to eclipse for all the jars you need.
Once for each workspace, Eclipse needs to know the path to the local maven repository. Therefore the classpath variable M2_REPO has to be set. Execute the following command: mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo |
Now you can run
mvn eclipse:eclipse from the root of you you module (e.g. /home/user/52n-repo/sas/trunk/ ).
Maven and xmlbeans
There are detailed instructions how to build ogcschema with maven and xmlbeans:
MavenOgcXmlbeans. Furthermore there is the former general
MavenXMLBeans description.
Frequently Asked Question
Unable to download the artifact from any repository
I get the error:
> [INFO] Scanning for projects...
> Downloading: http://repo1.maven.org/maven2/org/n52/swe/swe/1.0/swe-1.0.pom
> [INFO] -------------------------------------------------------------------
> -
> [ERROR] FATAL ERROR
> [INFO] -------------------------------------------------------------------
> -
> [INFO] Failed to resolve artifact.
>
> GroupId: org.n52.swe
> ArtifactId: swe
> Version: 1.0
>
> Reason: Unable to download the artifact from any repository
>
> org.n52.swe:swe:pom:1.0

If maven cannot find the swe-xxx.pom or on of the 52North-xxx.pom files, you need to add the 52North repository to your settings-file. See section configure above. --
JanTorbenHeuer - 02 Nov 2007
Cannot find parent: org.n52
i get the error:
> [INFO] Scanning for projects...
> [INFO] artifact org.n52:52-North: checking for updates from central
> [INFO] ------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO] ------------------------------------------------------------------------
> [INFO] Error building POM (may not be this project's POM).
>
>
> Project ID: org.n52.security:52n-security-api:pom:2.0-SNAPSHOT
>
> Reason: Cannot find parent: org.n52:52-North for project: org.n52.security:52n-s
> ecurity-api:pom:2.0-SNAPSHOT for project org.n52.security:52n-security-api:pom:2
> .0-SNAPSHOT

Make sure that your settings.xml is confgured correctly and located at USER_HOME\.m2. You can obtain the file below.
generics are not supported in -source 1.3
i get the error (similar to):
D:\workspace\common\src\main\java\org\n52\swe\common\types\IAnyNumerical.java:[4
1,30] generics are not supported in -source 1.3
(use -source 5 or higher to enable generics)
public interface IAnyNumerical> {
This means, that you have java code which is not compilable by java compiler less java5. Since mavens default java compiler level is less than 5 you have to add to your pom file the following:
<dependencies>
<!-- your dependencies here -->
</dependencies>
<build>
<!-- For annotations and other Java5 stuff -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
The current stable release of Maven (2.0.9) does not allow to specify more than one proxy server which is a problem if you need to deploy releases, snapshots, and sites from behind a proxy via webdav with https, while other urls need to be accessed via simple http.
I created patches for Maven 2.0.10-RC6 (
https://svn.apache.org/repos/asf/maven/components/tags/maven-2.0.10-RC6) and the maven site-plugin 2.0-beta-7 (
https://svn.apache.org/repos/asf/maven/plugins/tags/maven-site-plugin-2.0-beta-7) that allows to specify more than one proxy.