r19 - 21 Apr 2010 - 10:10:07 - EikeJuerrensYou are here: TWiki >  Documentation Web > MavenHome

maven.gif 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

arrowbright 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!)

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

Project Command (for GUI clients use just the url)
SAS
svn co https://svn.52north.org/svn/swe/main/SAS/
Security
svn co https://svn.52north.org/svn/security/
todo.gif |

todo.gif 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

right 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

TIP 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

right 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
TIP Make sure that your settings.xml is confgured correctly and located at USER_HOME\.m2. You can obtain the file below.

right 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>

right Deploy on https://52north.org/maven from behind a proxy

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.

Topic attachments
I Attachment Action Size Date Who Comment
elsediff maven-core.diff manage 1.5 K 13 Aug 2008 - 09:33 JanDrewnak patches maven
xmlxml settings.xml manage 10.0 K 02 Nov 2007 - 23:48 MartinWilden maven2 settings
elsediff site-plugin.diff manage 2.2 K 13 Aug 2008 - 09:33 JanDrewnak patches site-plugin
Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r19 < r18 < r17 < r16 < r15 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback