Installing JAR

For your projects, you may require Sun JAR files. For licensing reasons, they are not included in the Maestro distribution. To obtain these files, do the following:

  1. Download the JAR file you need.
  2. Install it into your local repository.

Sun JARS are not all located in one place, so first you'll have to locate the JAR file. To do so, specify the Sun JAR as a dependency in your pom.xml file, then run "mvn" or "mvn package" and you will get an error message back. This error message includes information about where the JAR file is located and how to install it into your local repository.

The following example illustrates the steps to perform in locating the Sun JAR file activation.jar.

Note: These steps assume you have already added the dependency for the missing JAR to your pom.xml file and you are ready to build.

  1. Run mvn install. This will not build successfully, but it will tell you where to locate the missing JAR file from and how to install it. You will see output similar to this:
      Downloading: http://repo1.maven.org/maven2/javax/activation/activation/1.0.2/acti
      [WARNING] Unable to get resource from repository central (http://repo1.maven.org/
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Failed to resolve artifact.
      Missing:
      ----------
        1) javax.activation:activation:jar:1.0.2
        
          Try downloading the file manually from:
            http://java.sun.com/products/javabeans/glasgow/jaf.html
          
          Then, install it using the command:
            mvn install:install-file -DgroupId=javax.activation -DartifactId=activation -Dversion=1.0.2 -Dpackaging=jar -Dfile=/path/to/file
          
          Path to dependency:
          1) javax.mail:mail:jar:1.3.1
          2) javax.activation:activation:jar:1.0.2
      ----------
      1 required artifact is missing.
      
      for artifact:
        javax.mail:mail:jar:1.3.1
      from the specified remote repositories:
        central (http://repo1.maven.org/maven2)
  2. Follow the instructions in the output to download and install the JAR file from the site specified. For example:

    http://java.sun.com/products/javabeans/glasgow/jaf.html

    If the downloaded file is in ZIP format, unzip it.

  3. Install the JAR file into your local repository, run the mvn command specified in the output. For this example, copy the activation.jar JAR file to the same directory as your pom.xml file. Then type the command:

    mvn install:install-file -DgroupId=javax.activation -DartifactId=activation -Dversion=1.0.2 -Dpackaging=jar -Dfile=activation.jar

    The following options were added to the mvn command:

    • groupId and artifactId: Sun JARS do not follow a standard naming scheme so check the Maven Wiki page http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html for help in determining the groupId and artifactId.
    • -Dfile: This argument specifies the path to the JAR file. If, for example, you had placed the JAR file in /temp, then you would specify it as: -Dfile=/temp/activation.jar.

    The mvn command you just executed will put the JAR file into your local maven repository. For example, if your local repository is under your home directory, the JAR file would be placed here: [user_home]/.m2/repository/javax/activation/activation/1.0.2.

  <project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>javax.mail</groupId>
    <artifactId>mail</artifactId>
    <version>1.3.3</version>
    <name>JavaMail API</name>
    <description>
      The JavaMail API provides a platform-independent and protocol-independent
      framework to build mail and messaging applications.
    </description>
    <url>http://java.sun.com/products/javamail/index.jsp</url>
    <distributionManagement>
      <downloadUrl>
        http://java.sun.com/products/javamail/downloads/index.html
      </downloadUrl>
    </distributionManagement>
    <dependencies>
      <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.0.2</version>
        <scope>compile</scope>
      </dependency>
    </dependencies>
  </project>

Copy the dependency information into the pom.xml file for your project, then start at step 1 above.

For more information on this process, go to:

http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html

http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

http://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html