Intellij-idea – set environment variables for ant script

antintellij-idearubymine

does anyone knows how to set additional environment variables for an ant script from within intellij-idea/rubymine? The part of the ant script which uses the environment variable looks as below:

  <property environment="env"/>
  <fail unless="env.IDEA_HOME" message="IDEA_HOME must be set."/>

What I've tried so far:

  • Passing an environment variable on startup to intellij
  • Settings -> Path Variables
  • Ant Build -> Properties
  • Ant Build -> Execution -> Ant command line

Best Answer

You can set variables as additional command line parameters. Here is a screenshot.

enter image description here

And then my output:

echoproperties
#Ant properties
#Sun Mar 04 04:48:30 EST 2012
\==-buildfile
ant.core.lib=E\:\\IntelliJ IDEA 114.145\\lib\\ant\\lib\\ant.jar
ant.file=E\:\\IdeaProjects\\psiviewer\\build.xml
ant.file.psiviewer=E\:\\IdeaProjects\\psiviewer\\build.xml
ant.file.type=file
ant.file.type.psiviewer=file
ant.home=E\:\\IntelliJ IDEA 114.145\\lib\\ant
ant.java.version=1.6
ant.library.dir=E\:\\IntelliJ IDEA 114.145\\lib\\ant\\lib
ant.project.default-target=all
ant.project.name=psiviewer
ant.version=Apache Ant(TM) version 1.8.2 compiled on December 20 2010
awt.toolkit=sun.awt.windows.WToolkit
basedir=E\:\\IdeaProjects\\psiviewer
dir.idea=e\:/idea11
file.encoding=windows-1252
file.encoding.pkg=sun.io

You see dir.idea is set to what we passed to ant.

Related Topic