{"id":1961,"date":"2017-12-07T06:14:06","date_gmt":"2017-12-07T06:14:06","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=1961"},"modified":"2021-11-18T07:11:50","modified_gmt":"2021-11-18T07:11:50","slug":"run-external-tasks-using-maven","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/run-external-tasks-using-maven\/","title":{"rendered":"Run external tasks using maven"},"content":{"rendered":"<p><strong>scmuser created the topic: Run external tasks using maven<\/strong><br>\nHi,<br>\nIs it possible to run ant tasks which is not connected with any build<br>\nlifecycle phase?<br>\nIn other word I would like to perform some action on demand using maven and<br>\nantrun plugin<\/p>\n<p><strong>tpatil replied the topic: Re:Run external tasks using maven<\/strong><br>\nTargets from external ant file can be run using maven-antrun-plugin.<\/p>\n<p> <code><plugin>\n    <artifactid>maven-antrun-plugin<\/artifactid><br>\n    <executions><br>\n      <execution>\n        <phase>test<\/phase>\n        <configuration><br>\n          <tasks><br>\n            <echo message=\"Hi there.\"><br>\n            <ant antfile=\"${basedir}\/build.xml\" target=\"test\"><br>\n          <\/ant><\/echo><\/tasks><br>\n        <\/configuration><br>\n        <goals><br>\n          <goal>run<\/goal><br>\n        <\/goals><br>\n      <\/execution><br>\n    <\/executions>\n  <\/plugin>\n<\/code><\/p>\n<p><strong>Also, you can execute the external command using maven-exec-plugin.<\/strong><\/p>\n<p><code><plugin>\n    <groupid>org.codehaus.mojo<\/groupid><br>\n    <artifactid>exec-maven-plugin<\/artifactid><br>\n    <version>1.1<\/version><br>\n    <executions><br>\n        <execution>\n            <phase>compile<\/phase>\n            <goals><br>\n                <goal>exec<\/goal><br>\n            <\/goals><br>\n        <\/execution><br>\n    <\/executions><br>\n    <configuration><br>\n        <executable>svn<\/executable><br>\n        <arguments><br>\n            <argument>info<\/argument><br>\n            <argument>--xml<\/argument><br>\n        <\/arguments><br>\n        <outputfile>target\/classes\/svninfo.txt<\/outputfile><br>\n    <\/configuration>\n<\/plugin><\/code><\/p>\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_33976\"><figure class=\"wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube epyt-figure\"><div class=\"wp-block-embed__wrapper\"><iframe loading=\"lazy\"  id=\"_ytid_49350\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_33976\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><\/div><\/figure><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>scmuser created the topic: Run external tasks using maven Hi, Is it possible to run ant tasks which is not connected with any build lifecycle phase? In other word I would like to perform some action on demand using maven and antrun plugin tpatil replied the topic: Re:Run external tasks using maven Targets from external&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[29],"tags":[161],"class_list":["post-1961","post","type-post","status-publish","format-standard","hentry","category-maven","tag-maven"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=1961"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1961\/revisions"}],"predecessor-version":[{"id":25717,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1961\/revisions\/25717"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=1961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=1961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=1961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}