Connecting to the Search Technologies Maven Repository (Aspire 2)

From wiki.searchtechnologies.com
Jump to: navigation, search

For Information on Aspire 3.1 Click Here

The easiest method for creating new components and new distributions with Aspire is to use the Search Technologies Maven repository for Aspire.

The Maven repository is available from the following URL:

Note: You will need to register with with Search Technologies before you can connect up to the Search Technologies Maven repository.

Install Maven Command-Line

It is recommended to access the repository using the Maven Command Line - especially for running the Aspire Maven archetypes. The command-line version of Maven is more up-to-date than the Eclipse version (in our experience) and so will run the archetypes more effectively.

  1. Download Maven from Apache Site: http://maven.apache.org/download.html
  2. Unzip/Untar Maven into the directory of your choice.
  3. Create two environment variables in your System Properties:
    • M2_HOME -> Maven directory path
      • (for example: C:\dev\apache-maven-2.1.0)
    • M2 ->  %M2_HOME%\bin
  4. Append the value ";%M2%" to your Path variable.
  5. Make sure your JAVA_HOME is set to your JDK version .
  6. Make sure your Path contains %JAVA_HOME%\bin.
  7. Test installation in 'cmd' window, as shown below:
 > mvn -v
 Apache Maven 3.0.5 (r755702; 2013-02-19 07:51:28-0600)
 Java version: 1.6.0_14
 Java home: C:\dev\jdk1.6.0_14\jre
 Default locale: en_US, platform encoding: Cp1252
 OS name: "windows 8" version: "6.2" arch: "amd64" Family: "windows"

For detailed steps, please refer to Step 2 of the Aspire Quick Start with Distribution Archetype tutorial.

Update the Maven Settings File to Connect to the Repository

In order to use the Maven repository (either within Eclipse or on the command), you will need to add the following to your Maven settings file. There are two possible locations for the maven settings file:

  • A user's install: ${user.home}/.m2/settings.xml
    • These are the user-specific settings (which only affect a single user).
    • For Windows users, this will typically be under:
      • Windows XP: C:\Documents and Settings\{username}\.m2
      • Windows 7: C:\Users\{username}\.m2
  • The Maven install: $M2_HOME/conf/settings.xml
    • This is the global settings file which affect all users on the machine. For most people, M2_HOME will be where you installed the maven command-line program.

Probably the user-specific version is safer and is most likely to be picked up by both the Maven command line and Maven for Eclipse.

Once you have registered, use your registered username and password to replace "REGISTERED-USERNAME" and "REGISTERED-PASSWORD" below.

<?xml version="1.0" encoding="UTF-8"?>
<!--
  ********************************************************************************************
  **
  ** Copyright Search Technologies 2015
  **
  **~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  **
  ** Aspire Maven settings.xml
  **
  ** This file is configured by default to run in "public" mode, connecting to 
  ** http://repository.searchtechnologies.com/artifactory/public
  **
  ** There are two profiles:
  **
  ** server:   sets the stRepositoryServer variable (used in all urls) to point to the main
  **           Artifactory server (default)
  **
  ** public:   sets the repository url to ${stRepositoryServer}/artifactory/public
  **           This is the main (default) profile for general use. The public repository
  **           covers the release repository and the "stable" snapshots
-->
<settings>
  <servers>
    <server>
      <id>stPublic</id>
      <username>REGISTERED-USERNAME</username>
      <password>REGISTERED-PASSWORD</password>
    </server>
  </servers>
  <profiles>
    <profile>
      <id>server</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <!-- Search Technologies' Artifactory server -->
        <stRepositoryServer>http://repository.searchtechnologies.com</stRepositoryServer>
      </properties>
    </profile>
    <profile>
      <id>public</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <!-- Artifactory URL -->
        <stPublicUrl>${stRepositoryServer}/artifactory/public</stPublicUrl>
      </properties>
      <repositories>
        <repository>
          <id>stPublic</id>
          <url>${stRepositoryServer}/artifactory/public</url>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </releases>
        </repository>
        <repository>
          <id>cloudera</id>
          <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
        </repository>        
      </repositories>
    </profile>
  </profiles>
</settings>

For detailed steps, please refer to Step 3 of the Aspire Quick Start with Distribution Archetype tutorial.

Maven with Eclipse

Maven for Eclipse (m2eclipse) seems to work just fine for other Maven tasks (such as clean, package, and install).

For more details, see Eclipse plus Maven (Aspire 2).

Mirrors

The following configuration can be added to your settings file (after the </servers> tag) to turn on mirrors:

 <mirrors>
   <mirror>
     <id>archivaInternal</id>
     <mirrorOf>central,maven2-repository.dev.java.net</mirrorOf>
     <name>Mirrof Of Maven Central Repository and Java.net</name>
     <url>http://repository.searchtechnologies.com/artifactory/simple/internal/</url>
   </mirror>
 </mirrors>