I am attempting to convert an ant task which uses fmpp over to gradle. I am unable to get my project to build. I have the following in my build.xml file:
<project name="website">
<property file="build.properties" />
<property name="src.dir" location="src" />
<property name="build.dir" location="build" />
<taskdef name="fmpp" classname="fmpp.tools.AntTask">
<classpath>
<pathelement location="lib/fmpp.jar"/>
</classpath>
</taskdef>
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="dist">
<fmpp sourceRoot="${src.dir}" outputRoot="${build.dir}">
<data expandProperties="yes">
base_url: ${base_url}
google_analytics_number: ${google_analytics_number}
mail_user: ${mail_user}
mail_password: ${mail_password}
mail_recipient: ${mail_recipient}
upload_folder: ${upload_folder}
host: ${host}
port: ${port}
</data>
</fmpp>
</target>
</project>
my build.gradle file looks like this
ant.taskdef(name: 'fmpp', classname:'fmpp.tools.AntTask') {
classpath {
fileset(dir: 'lib', includes: '*.jar')
}
}
ant.fmpp(sourceRoot:"src", outputRoot :"build") {
data(expandProperties: 'yes'){
base_url = base_url
google_analytics_number = google_analytics_number
mail_user = mail_user
mail_password = mail_password
mail_recipient = mail_recipient
upload_folder = upload_folder
host = host
port = port
}
}
but when I run it I get the following error
FMPP processing session failed. Caused by: freemarker.core.InvalidReferenceException: Expression base_url is undefined on line 15, column 47 in data/header.htm.
So it seems like the template variable in the htm file isn't being properly picked up and implemented in my my build. I am not sure how to get around this. There are a few gradle plugins for fmpp but have very limited documentation and I am having difficulty getting any of them to work. If any one has suggestions or a work around it would be greatly appreciated.
*** Update
Here is an example of the htm file that's trying to be applied
<head>
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$page = basename($_SERVER['PHP_SELF']);
require_once($_SERVER['DOCUMENT_ROOT'] . '/js/functions.php');
?>
<title>
<#if title??> ${title}
<#else> CompSci Resources, LLC | The Complete EDGAR and XBRL Filing Platform, and more!
</#if>
</title>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
<script type='text/javascript' src='${base_url}/js/bootstrap-filestyle.min.js'> </script>
<script type='text/javascript' src='${base_url}/js/bootstrap.min.js'></script>
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jcarousel/0.3.4/jquery.jcarousel.js'></script>
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jcarousel/0.3.4/jquery.jcarousel-autoscroll.min.js'></script>
<script type='text/javascript' src='${base_url}/js/compsci.js'></script>
<script type='text/javascript' src='${base_url}/js/carousel.js'></script>
<script type='text/javascript' src='${base_url}/js/readmore.js'></script>
<link rel='shortcut icon' href='${base_url}/images/littlelogo.png' >
<link rel='stylesheet' type='text/css' href='${base_url}/css/jcarousel.css' >
<link rel='stylesheet' type='text/css' href='${base_url}/css/bootstrap.css'>
<link rel='stylesheet' type='text/css' media='screen, projection' href='${base_url}/css/compsci.css'>
<style type='text/css'>
@media screen and (-webkit-min-device-pixel-ratio:0) {
h2 { font-weight: normal; }
.csr-services-popper-left { margin-top:11px; }
}
</style>
<!-- Google Analytics -->
<script type='text/javascript'>
//Google Analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '${google_analytics_number}']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<meta charset="UTF-8">
<meta name="language" content="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />