Developer

Configuring Apache Maven

You can customize where Maven looks for dependencies by editing the Maven configuration file.

Prerequisites

Install Apache Maven.

Context

By default, Maven looks for dependencies in its central repository; however, in some cases, it may need additional repositories. For example, some companies have their own internal Maven repositories, and you, as a developer, must find these dependencies. The central Maven repository is open to the public, and its libraries are either open source or available for public use. SMS Builder SDK libraries are not hosted in the central Maven repository, nor in any publicly accessible Maven repository.

Procedure

  1. Navigate to your Apache Maven installation directory, and open the conf\setting.xml file.
  2. Enter these lines:
    <settings>
    
     <profiles>
      <profile>
       <id>brand_state_development</id>
       <repositories>
        <repository> 
         <id>EclipseLink</id>
         <name>Eclipse Link</name>
         <url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
        </repository>
       </repositories>
      </profile>
     </profiles>
    
      <activeProfiles>
        <activeProfile>brand_state_development</activeProfile>
      </activeProfiles>
      
    </settings>
  3. To add a Maven dependency location, between the <repositories></repositories> elements, add a <repository></repository> element pair.
  4. For the new repository, define:
    • id – repository ID.
    • name – name of the repository.
    • url – Internet location of the repository.

Results

Maven creates a default-user local cache repository in ${<user.home>}\.m2\repository, where <user.home> depends on the operating system. For example, on a Windows 7 machine, the <user.home> location is C:\Users\userName. During the build process, this is the first location Maven searches for dependency libraries. Initially, the local repository is empty. During the first build, Maven does not find libraries in the local repository, so it looks in the Maven central repository, which is, by default, http://search.maven.org/#browseInformation published on non-SAP site. Maven downloads any dependency libraries to the local repository, then uses them in the build. Subsequent builds are faster, because dependency libraries have been downloaded to the local repository.

Next Steps

Deploy State SDK bundles to Maven repositories.