Skip to content

Add an algorithm to the metanome algorithms repository (internal)

Joana Be edited this page May 26, 2019 · 6 revisions

We collect our profiling algorithms in an internal repository. Only those algorithms that deliver reliable functionality should be added. All algorithms in this repository are continuously maintained and upgraded to newer versions with every release of the Metanome framework. To add an existing algorithm project to the repository the following steps should be followed:

  1. Copy the maven project into a subdirectory of the algorithms repository.

  2. Use the following pattern for the naming of your algorithm artifact in the subdirectory's pom file:

      <groupId>de.metanome.algorithms.[algorithm-name-lowercase]</groupId>
      <artifactId>[algorithm-name]</artifactId>
      <packaging>jar</packaging>
      <name>[algorithm-name]</name>
    
  3. Add the algorithm project as a module to the root pom of the repository by adding <module>[algorithm-name]</module> in the <modules>-tag.

  4. Set the parent pom to the root pom using the root's current version:

      <parent>
        <groupId>de.metanome.algorithms</groupId>
        <artifactId>algorithms</artifactId>
        <version>1.2-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
      </parent>
    
  5. Remove the version tags of your project and all dependencies to Metanome subprojects; these versions are inherited from the root pom.

  6. Remove unnecessary repository information, e.g., all repositories that are defined in root/parent should not be duplicated.

  7. When copying the <build>-tag in the example down below, make sure to adjust the <Algorithm-Bootstrap-Class> to the name of your class

  8. Add the jar file of the new algorithm to the collect.bat and collect.sh files found in the root directory.

In the end, the base of your added pom file should look similiar to this:

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>de.metanome.algorithms.[algorithm-name-lowercase]</groupId>
  <artifactId>[algorithm-name]</artifactId>
  <packaging>jar</packaging>
  <name>[algorithm-name]</name>

  <parent>
    <groupId>de.metanome.algorithms</groupId>
    <artifactId>algorithms</artifactId>
    <version>1.2-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>de.metanome</groupId>
      <artifactId>algorithm_integration</artifactId>
    </dependency>

    <dependency>
      <groupId>de.metanome</groupId>
      <artifactId>backend</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>2.8.1</version>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <showWarnings>true</showWarnings>
          <showDeprecation>true</showDeprecation>
          <compilerArgument>-Xlint:all</compilerArgument>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.1.1</version>
        <configuration>
          <archive>
            <manifestEntries>
              <Algorithm-Bootstrap-Class>
                de.metanome.algorithms.[algorithm-name].[algorithm-class-name]
              </Algorithm-Bootstrap-Class>
            </manifestEntries>
          </archive>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
          <appendAssemblyId>false</appendAssemblyId>
        </configuration>
        <executions>
          <execution>
            <id>assemble-all</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>