Set environment variables for ant script

Does anyone know how to set additional environment variables for ant script from inside intellij-idea / rubimine? The part of the ant script that uses the environment variable is as follows:

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

What I have tried so far:

  • Passing environment variable at startup for intellij
  • Settings โ†’ Path Variables
  • Ant Build โ†’ Properties
  • Ant String -> Run -> ant command line
+6
source share
2 answers

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

enter image description here

And then my conclusion:

 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 that dir.idea set to what we passed to ant.

+2
source

Problem: run ant build inside IntelliJ, let the ant build property be used to use the values โ€‹โ€‹of the IntelliJ Path variables

Decision:

  • Added path variable QC1_SHELL_DEPLOY for intelliJ IntelliJ parameters โ†’ Path variables
  • In the Ant Build window (views โ†’ Windows Tool โ†’ ant Build), right-click on the ant script (assuming you have one), click properties . create a property for ant script qc_deploy_dir . property for ant script with arbitrary value

  • Open ant.xml in the .idea / ant.xml project, change the line defining qc_deploy_dir to use the IntelliJ Path Variable $ QC1_SHELL_DEPLOY property change for ant.xml

  • Return to the properties window for the ant script, now qc_deploy_dir is gaining the value QC1_SHELL_DEPLOY .

+1
source

Source: https://habr.com/ru/post/909814/


All Articles