I´ve been searching for a way to automatically convert my readme.md file into a .pdf using a gradle task. I know that I can do this by using my prompt console, and it works fine, but I want to know if there is a way of doing the same by creating a gradle task. I´ve found some gitHub projects, and I´ve try some of them, but I always get errors in applying the needed plugins. There is a simple way of doing this, I know that gradle has a huge amount of task types, but I can´t find one for this. Can someone help me?
I´ve trying to use the plugin from https://github.com/fntsoftware/gradle-plugin-markdown2pdf, but when I run the implemented gradle task, I get the error: Could not get unknown property 'MarkdownToPdfTask' for root project 'cms' of type org.gradle.api.Project
My build gradle from root path:
plugins {
id 'java'
id 'war'
id 'jacoco'
id 'eclipse'
id "fr.putnami.gwt" version "0.4.0"
id "info.solidsoft.pitest" version "1.3.0"
id "de.fntsoftware.gradle.markdown-to-pdf" version "1.1.0"
}
repositories {
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.easymock:easymock:2.5.2'
testCompile 'com.google.gwt:gwt-dev:2.8.1'
compile 'net.sourceforge.plantuml:plantuml:8001'
}
task exampleTask1(type: MarkdownToPdfTask){
inputFile = '/PATH/TO/README.md'
outputFile = '/PATH/TO/README.pdf'
}
My build gradle from buildSrc path:
plugins {
id "de.fntsoftware.gradle.markdown-to-pdf" version "1.1.0"
}
repositories {
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
// compile gradleApi()
compile 'org.codehaus.groovy:groovy:2.4.2'
compile 'commons-io:commons-io:2.4'
compile 'net.sourceforge.plantuml:plantuml:8051'
}
Thank you.
MarkdownToPdfTask
is a class, and because it is not in the Gradle namespace (it's from a 3rd party plugin) it needs to be qualified. I can see that the documentation doesn't mention this, but try putting the following at the top of the script:
import de.fntsoftware.gradle.MarkdownToPdfTask
Otherwise, Gradle thinks it is a property.