{"id":3098,"date":"2010-02-08T12:47:49","date_gmt":"2010-02-08T12:47:49","guid":{"rendered":""},"modified":"2026-04-18T22:54:42","modified_gmt":"2026-04-18T22:54:42","slug":"the-maven-ant-plugin-and-java_home","status":"publish","type":"post","link":"https:\/\/hellem.org\/wblog\/?p=3098","title":{"rendered":"The Maven Ant plugin and JAVA_HOME"},"content":{"rendered":"<p>I&#8217;ve spent some time, with great help from two of my colleagues, creating a pom.xml using the <a href=\"http:\/\/maven.apache.org\/plugins\/maven-ant-plugin\">Maven Ant plugin<\/a> to call Ant targets in the build.xml file downloaded along with the source code for <a href=\"http:\/\/jakarta.apache.org\/jmeter\/\">JMeter<\/a>. Got the plugin working without to much struggle, but when trying to call &#8220;ant compile&#8221; from Maven &#8220;mvn compile&#8221; I got an error saying that no compiler was found since the JAVA_HOME variable was pointing to &#8220;&#8230;\\jdk\\jre&#8221; But all attempts to change the variable to &#8220;..\\jdk&#8221; just returned the same error. Very strange since I could compile other Maven-projects without any problems and calling compile using Ant directly caused no problem.<\/p>\n<p>But, then as always, Google to the rescue. The line below in bold was all what I needed.<\/p>\n<p><code>&lt;execution&gt;<br \/>\n\t&lt;id&gt;compile&lt;\/id&gt;<br \/>\n\t&lt;phase&gt;compile&lt;\/phase&gt;<br \/>\n\t&lt;configuration&gt;<br \/>\n\t\t<strong>&lt;property name=\"build.compiler\" value=\"extJavac\"\/&gt;<\/strong><br \/>\n\t\t&lt;tasks&gt;<br \/>\n\t\t\t&lt;ant antfile=\"${basedir}\/build.xml\"&gt;<br \/>\n\t\t\t\t&lt;target name=\"compile\" \/&gt;<br \/>\n\t\t\t&lt;\/ant&gt;<br \/>\n\t\t&lt;\/tasks&gt;<br \/>\n\t&lt;\/configuration&gt;<br \/>\n\t&lt;goals&gt;<br \/>\n\t\t&lt;goal&gt;run&lt;\/goal&gt;<br \/>\n\t&lt;\/goals&gt;<br \/>\n&lt;\/execution&gt;<\/code><\/p>\n<p>Found a post where someone else had got an <a href=\"http:\/\/mail-archives.apache.org\/mod_mbox\/maven-users\/200701.mbox\/%3C8167000.post@talk.nabble.com%3E\">error trying to use the maven-antrun plugin<\/a>. It is in fact a property passed on to Ant, see <a href=\"http:\/\/ant.apache.org\/manual\/CoreTasks\/javac.html\">ant.apache.org\/manual\/CoreTasks\/javac.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve spent some time, with great help from two of my colleagues, creating a pom.xml using the Maven Ant plugin to call Ant targets in the build.xml file downloaded along with the source code for JMeter. Got the plugin working without to much struggle, but when trying to call &#8220;ant compile&#8221; from Maven &#8220;mvn compile&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":["post-3098","post","type-post","status-publish","format-standard","hentry","category-work-geek"],"_links":{"self":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts\/3098","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3098"}],"version-history":[{"count":1,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts\/3098\/revisions"}],"predecessor-version":[{"id":14505,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts\/3098\/revisions\/14505"}],"wp:attachment":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}