Maven

<< Click to Display Table of Contents >>

Navigation:  Platforms and wrappers > Java and jSMILE >

Maven

If your Java project uses Maven, you can integrate jSMILE using BayesFusion's Maven repository. 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 provides three platform-specific .zip artifacts containing the native libraries:

jsmile-native-win64 for 64-bit Windows

jsmile-native-linux64 for 64-bit Linux

jsmile-native-macos for macOS

Do not add references to these artifacts in the <dependencies> section of the POM file. Instead, use the maven-dependency-plugin to integrate them with your Maven 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 platforms, the artifact ID specified in the plugin configuration can directly reference the corresponding artifact listed above. Alternatively, you can use Maven's OS-based profile activation to select the appropriate native library. The POM file below demonstrates this approach. Note that the CPU architecture is not checked (a 64-bit environment is assumed for both Windows and Linux). In this example, the extracted library is placed in ${project.basedir}, and the referenced jSMILE version 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>