Install GroupDocs.Markdown for Java

This topic describes how to add the GroupDocs.Markdown library to your Java project.

Prerequisites

  1. Java Development Kit – JDK 8 or later.
  2. Build tool – Maven, Gradle, Kotlin DSL, Ivy, or Sbt for dependency management.
  3. License (optional) – run in evaluation mode or apply a temporary license.

Install from the GroupDocs Repository

All GroupDocs Java packages are hosted at the GroupDocs Artifact Repository rather than Maven Central, so you must add the repository before declaring the dependency.

Add the GroupDocs Artifact Repository

<repositories>
  <repository>
    <id>GroupDocs Artifact Repository</id>
    <name>GroupDocs Artifact Repository</name>
    <url>https://releases.groupdocs.com/java/repo/</url>
  </repository>
</repositories>
repositories {
  maven {
    url "https://repository.groupdocs.com/repo/"
  }
}
repositories {
  maven(url = "https://repository.groupdocs.com/repo/")
}
<ivysettings>
  <settings defaultResolver="chain"/>
  <resolvers>
    <chain name="chain">
      <ibiblio name="GroupDocs Repository" m2compatible="true" root="https://releases.groupdocs.com/java/repo/"/>
    </chain>
  </resolvers>
</ivysettings>
resolvers += Resolver.url("GroupDocs Repository", url("https://releases.groupdocs.com/java/repo/"))

Add GroupDocs.Markdown as a dependency

Replace latest-version with the version you want to use. The current release is latest-version.

<dependencies>
  <dependency>
    <groupId>com.groupdocs</groupId>
    <artifactId>groupdocs-markdown</artifactId>
    <version>latest-version</version>
  </dependency>
</dependencies>
dependencies {
  implementation 'com.groupdocs:groupdocs-markdown:latest-version'
}
dependencies {
  implementation("com.groupdocs:groupdocs-markdown:latest-version")
}
<dependency org="com.groupdocs" name="groupdocs-markdown" rev="latest-version">
  <artifact name="groupdocs-markdown" ext="jar"/>
</dependency>
libraryDependencies += "com.groupdocs" % "groupdocs-markdown" % "latest-version"

Manual JAR download

You can also download the JAR directly from the GroupDocs downloads page and add it to your project’s classpath manually.

Example: a minimal command line application

Create the following project structure:

|--- pom.xml
|--- business-plan.docx
|--- src
     |--- main
          |-- java
              |-- com
                  |-- mycompany
                      |-- app
                          |-- App.java
package com.mycompany.app;

import com.groupdocs.markdown.MarkdownConverter;

public class App {

    public static void main(String[] args) {
        MarkdownConverter.toFile("business-plan.docx", "business-plan.md");
        System.out.println("Conversion complete");
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<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>com.mycompany.app</groupId>
  <artifactId>markdown-helloworld</artifactId>
  <version>1.0-SNAPSHOT</version>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.groupdocs</groupId>
      <artifactId>groupdocs-markdown</artifactId>
      <version>latest-version</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <archive>
            <manifest>
              <mainClass>com.mycompany.app.App</mainClass>
            </manifest>
          </archive>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <id>GroupDocs Artifact Repository</id>
      <name>GroupDocs Artifact Repository</name>
      <url>https://releases.groupdocs.com/java/repo/</url>
    </repository>
  </repositories>
</project>

Build it from the directory containing pom.xml:

mvn clean package

Then run it:

java -jar target/markdown-helloworld-1.0-SNAPSHOT-jar-with-dependencies.jar

The program prints:

Conversion complete

and writes business-plan.md next to the source document.

Note
You can create and run this project in your IDE instead, or build it with Gradle – nothing in the library depends on Maven.

Verify Installation

After installing, verify that the library is on the classpath:

import com.groupdocs.markdown.*;

public class VerifyInstall {

    public static void main(String[] args) {
        // List all supported formats
        for (FileFormat format : MarkdownConverter.getSupportedFormats()) {
            System.out.println(format);
        }
    }
}
Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.