How to set path variables in ant - ant

LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
PATH=/usr/bin:${PATH}
export PATH
SQLPATH=/usr/lib/oracle/11.2/client64/lib:${SQLPATH}
export SQLPATH
Hi all,
This is the path variables I am setting in my shell script. I want to set this same in my ant file. Can you please explain how to set these variables in ant?

Related

Ant is not recognized error in JMeter reports

I am struggling an issue to run ant with JMeter.
I downloaded apache-ant-1.10.3-bin.zip and put it in C:\ant
I extract the ZIP and it created another ant folder (see pic), this is the bin folder C:\ant\ant\bin
I entered to control panel -> system properties -> Advanced tab -> Environment Variables
Under user variables under path I entered ;C:\ant\ant\bin
Under System variable I enter Variable ANT_HOME and value C:\ant\ant\bin
I opened cmd and run ant -version
I got 'ant' ant is not recognized as as internal
what am I missing?
[][path of extracted zip]
[][path of bin file]
[][enter bin file]
[][system variable]
[][system variable2]
[][error in cmd]
ANT_HOME variable should be set to the main folder of ant and not c:\ant\ant\bin
Set the variable name to ANT_HOME and the variable value to apache-install-dir\apache-ant-version and click OK.
For example, the installation directory might be C:\Java\apache-ant-1.7.0.
Select New again to create the ANT_OPTS environment variable.
Set the variable name to ANT_OPTS and the variable value to -Xms256M -Xmx512M and click OK.
Select the PATH environment variable and select Edit.
Add %ANT_HOME%\bin to the end or beginning of the PATH.
In your case set it to
c:\ant\ant

Is it possible to use environment variable in sonar-project.properties file

I am executing sonar through Jenkins build, there is use-case where 'src' location changes depending upon build so i want to use environment variable for specifying 'src' path.
For example in sonar-project.properties i want to specify as shown below:
src= c:/project/workspace instead i want to use src =${SONAR_RUN_WORKSPACE}
Environment variables are supported in sonar-project.properties starting from SonarQube Scanner version 2.9 (see SQSCANNER-9).
So, this should work now:
sonar.sources=${env.SONAR_RUN_WORKSPACE}
You cannot pass env variable into sonar-project.property file.
If you are creating sonar-project.property file from jenkins, you can use build with param.
(or)
Create a sonar-project.properties without sonar.source.
Create build with param variable {path}, get the src path from user for each build,
Map the variable with sonar.source=${path} in sh.
Append sonar.source to sonar-project.properties for each build in sh using (>>) or cmd from jenkins.
eg) sonar.source="path" >> sonar-project.properties
finally work space contains sonar-project.properties file with src path.
Nope, environment variables are not supported in sonar-project.properties. In any case, back to your use-case: you better use a relative path for sonar.sources so that, wherever analysis is ran (i.e. whatever workspace with Jenkins), sources are always found at the expected place (from the project's base directory).

Jenkins envInject Plugin not picking PATH

I have my Jenkins configured to Inject environment variables to the build process and set the Properties File Path to G:\Jenkins\env.properties
Inside my env.properties
VISUALSTUDIOVERSION=12.0
PATH=$PATH
When I run my job, the PATH is not reflecting my system path instead its just showing $PATH only. How can I edit my env.properties file to pick up system PATH?
THe output of Env variables after build is
VISUALSTUDIOVERSION=12.0
PATH=$PATH
But I am expecting to see it as
VISUALSTUDIOVERSION=12.0
PATH=C:\Program Files (x86)\Perl\site\bin;C:\Program Files (x86)\Perl\bin;
Environment variables in Java are case-sensitive. Try Path instead of PATH.

How to set environment variable in Solaris 11 for ant?

I am trying to install ant in Solaris. I am using this:
https://ant.apache.org/manual/install.html
but I have no idea how to set the ANT_HOME environment variable. Please help?
If you want to set the ANT_HOME temporally, typing export ANT_HOME=you ant path in your installing terminal. Otherwise, you can add ANT_HOME permanently by adding a line of export ANT_HOME=you ant path in /etc/profile file (you have to own root privilege).

How can I run ANT from a batch file without having an Environment Variable set?

I want to include ANT, the JavaSDK and FlexSDK into my project directory. I need people in my company to be able to compile from source code.
I have a build.bat file which starts with :
ant blah/blah/blah
But what if I want to run ANT directly without the system environment variable? If I remove these from the system ant is not recognised.
I am a real newbie here, but I want to do something like this:
start "${basedir}\libs\ant\bin" ant -lib ${basedir}/libs/ant/lib/flexTasks.jar
pause
This is so that other people dont need to install a whole load of software... IT would all be contained in the folder.
Just set those environment variables in the same batchfile, i.e. something like :
set ANT_HOME=C:\ant182
set ANT_ARGS=-lib C:\antxtralibs
set JAVA_HOME=C:\jdk160_30
set PATH=%PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin
:: default
ant -f %1
:: debug
:: ant -debug -f %1

Resources