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
Related
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).
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.
I am trying to set the class path on win 7 and after doing all the necessary variables when I try to execute mvn --version I am getting this error -"mvn is not recognized"
In system variable I have set M2_HOME and the value is set to --- C:\Users\Amzi\Desktop\apache-maven-3.0.4-bin
in to the path variable at the end I have set the value like
;C:\Users\Amzi\Desktop\apache-maven-3.0.4-bin\bin
can someone help me what I am doing wrong here. Thanks
To run maven from command line in Windows 7 you should have properly set JAVA_HOME, M2_HOME & PATH environment variables in the following table:
Start button -> Computer menu item -> Properties on right click menu item ->
Advanced System Settings button on left panel -> Advanced tab in System Properties dialog ->
Environment Variables button -> System variables table
JAVA_HOME set to directory where JDK is installed:
C:\Program Files\Java\jdk1.7.0_06
M2_HOME set to extraction directory of Maven distribution:
C:\Program Files\Maven\apache-maven-3.0.4
Additional entries in PATH for JDK and Maven binaries:
%JAVA_HOME%\bin;%M2_HOME%\bin;
consider the following example:
<project basedir="${env.DIR}">
...
</project>
Is it possible to access an environment variable in the project element along these lines?
No you can't. Neither can you use a property there. You have to change them from the way you call your build file. E.g. if you call it with another ant task , you can set the basedir attribute there.
If you call your build file from Eclipse, to set the Base Directory property from the task that runs the ant build file you can:
Right click on the build file
Choose "Run As" -> "External Tool Configurations..."
Under the "Main" tab, use the Base Directory box to enter the directory, but note the syntax of defining an environment variable here, for example if your environment variable is named "DIR", it would be: ${env_var.DIR}
this is a batch file that i have. It is located in C:\Work\6.70_Extensions\Lab Tools\ folder.
ANT.BAT:
set CLASSPATH=%CLASSPATH%;.;c:\JavaMail\javamail-1.3\mail.jar;c:\JavaMail\javamail-1.3\mailapi.jar;c:\JavaMail\javamail-1.3\pop3.jar;c:\JavaMail\javamail-1.3\smtp.jar;c:\JavaMail\jaf-1.0.2\activation.jar
CALL "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
#echo on
%ANT_HOME%\bin\ant -logger org.apache.tools.ant.listener.MailLogger -q -buildfile "Master Build.xml"
pause
along with ant.bat, i have a Master Build.xml file located inside the same folder.
When i double click on ant.bat, it will execute the Master Build.xml ant script properly.
However, whenever i try to use another application to open the batch file's absolute path, it always state that Master Build.xml file does not exist!
I tried to open the absolute path using both console application and another ANT Script(via Cruisecontrol framework) but both gives the same error. What is the error here?
for your information here is what ive done with cruisecontrol:
create config.xml (to set intervals for builds)
create nightbuild.xml (so that config.xml will go into it to perform required tasks)
nightbuild.xml will run several console applications to sort files, checkout files from version control etc
lastly, nightbuild.xml will execute ant.bat file to execute the build
These files, config.xml and nightbuild.xml are found in C:\build
When you execute from a directory other than the one containing Master Build.xml, Ant will fail to find the build file, which it expects to be in the current working directory.
You could set an additional environment variable to specify the path to the build file, e.g.
%ANT_HOME%\bin\ant -buildfile "%MASTER_BUILD%\Master Build.xml"
If you set your variable to an absolute path (e.g. C:\Work\6.70_Extensions\Lab Tools) then it will always work. If you use a relative path (e.g. .\Lab Tools), then it will only work if executed from the relative root dir.
(BTW, life will probably be easier if you use buildfiles without spaces in their names, e.g. master_build.xml rather than Master Build.xml).