Maven

<< Click to Display Table of Contents >>

Navigation:  Platforms and Wrappers > Java and jSMILE >

Maven

If your Java project uses Maven, you can use BayesFusion's Maven repository to integrate jSMILE with your project. The repository URL is https://support.bayesfusion.com/maven-X, where X is either A for jSMILE Academic, or B for the commercial version of the library. The artifact id is jsmile and the group id is com.bayesfusion, regardless of the repository used.

In addition to the jsmile artifact, the repository contains three separate .zip artifacts for three platform-specific native libraries:

jsmile-native-win64 for 64-bit Windows

jsmile-native-linux64 for 64-bit Linux

jsmile-native-macos for macOS

Please do not add the references to these artifacts in the <dependencies> section of the POM file. Instead, use the maven-dependency-plugin to integrate these with your Maven-based build process and ensure that the native library is extracted from the artifact's .zip file into the project directory during the compile phase. For projects that only run on one of the three supported native platforms, the artifact id specified in the plugin configuration can refer directly to one of three artifacts listed above. Another option is to use Maven's OS-based profile activation to select the appropriate native library. The POM file below uses this approach. Note that the CPU architecture is not tested against (we assume 64-bit environment for Windows and Linux). The location of the extracted library is arbitrarily set to ${project.basedir}. jSMILE version referenced in the POM is set to 2.2.0.

<project xmlns="http://maven.apache.org/POM/4.0.0"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xsi:schemaLocation=

    "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>com.bayesfusion</groupId>

  <artifactId>test-maven-repo</artifactId>

  <version>0.0.1-SNAPSHOT</version>

 

  <repositories>

    <repository>

      <id>bayesfusion-repo</id>

         <name>BayesFusion Repository</name>

         <url>https://support.bayesfusion.com/maven-B</url>

    </repository>

  </repositories>

 

  <dependencies>

    <dependency>

      <groupId>com.bayesfusion</groupId>

      <artifactId>jsmile</artifactId>

      <version>2.2.0</version>

    </dependency>

  </dependencies>

 

  <profiles>

    <profile>

      <id>MacNative</id>

      <activation>

        <os>

          <family>mac</family>

        </os>

      </activation>

      <properties>

        <nativeSuffix>macos</nativeSuffix>

      </properties>

    </profile>

    <profile>

      <id>WinNative</id>

      <activation>

        <os>

          <family>Windows</family>

        </os>

      </activation>

      <properties>

        <nativeSuffix>win64</nativeSuffix>

      </properties>

    </profile>

    <profile>

      <id>LinuxNative</id>

      <activation>

        <os>

          <family>Unix</family>

        </os>

      </activation>

      <properties>

        <nativeSuffix>linux64</nativeSuffix>

      </properties>

    </profile>

  </profiles>

  

  <build>

    <plugins>

      <plugin>

        <groupId>org.apache.maven.plugins</groupId>

        <artifactId>maven-dependency-plugin</artifactId>

        <executions>

          <execution>

            <id>resource-dependencies</id>

            <phase>compile</phase>

            <goals>

              <goal>unpack</goal>

            </goals>

            <configuration>

              <artifactItems>

                <artifactItem>

                  <groupId>com.bayesfusion</groupId>

                  <artifactId>jsmile-native-${nativeSuffix}</artifactId>

                  <version>2.2.0</version>

                  <type>zip</type>

                  <overWrite>true</overWrite>

                  <includes>*jsmile*</includes>

                </artifactItem>

              </artifactItems>

              <outputDirectory>${project.basedir}</outputDirectory>

            </configuration>

          </execution>

        </executions>

      </plugin>

    </plugins>

  </build>

 

</project>