Skip to content

nikita715/mossclient

Repository files navigation

Build Status Codacy Badge

Mossclient

Simple client for Moss. It can be used in Java or Kotlin applications.

Usage

  1. Obtain a moss id by following the Moss registration instructions. You will find the id in the middle of the submission script in your mailbox.
  2. Add this in your build.gradle
repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.nikita715:mossclient:1.1.1'
}

or this in your pom.xml

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.nikita715</groupId>
        <artifactId>mossclient</artifactId>
        <version>1.1.1</version>
    </dependency>
</dependencies>
  1. Submit files for an analysis
List<File> bases = Arrays.asList(
        new File("path/to/basefile1"),
        new File("path/to/basefile2")
);

List<Pair<String, File>> solutions = Arrays.asList(
        new Pair<>("student1", new File("path/to/solution1")),
        new Pair<>("student2", new File("path/to/solution2")),
        new Pair<>("student3", new File("path/to/solution3"))
);

String mossId = "12345678"

MossClient mossClient = new MossClient(mossId, Language.JAVA)
    .submitFiles(bases, true)
    .submitNamedFiles(solutions);
String resultUrl = mossClient.getResult();
  1. Look at the analysis result by the resultUrl

More examples available here