ant lib not being pulled into classpath
I have a directory structure like this:
dev/buildxml
dev/lib/ant.jar, bsf.jar, etc
When I run a task from TC that needs some optional ant libs (like bsf.jar, jruby.jar stuff), I get an exception for the script task: Unable to load a script engine manager (org.apache.bsf.BSFManager or javax.script.ScriptEngineManager)
This works fine from the command line.
I'm guessing it's a classpath problem. How to I get the dev/lib jars into my classpath? I tried setting ant home in TC to dev/ and dev/lib but it didn't seem to matter. Where does TC assume all the optional ant task jars are located?
The problem chunk of my build.xml is:
puts "Deploying portlets to MWS install..."
require 'opt_ruby/portlet_util.rb'
copy_portlets($portlet_src_dir, $portlet_dest_dir, $portlet_start_time)
]]>
Please sign in to leave a comment.
Phil,
From the command line, which Ant do you use to run your build? Does your Ant installation contains jar files for your tasks (these bsf.jar and jruby.jar)? Did you try specifying ant home directory location to this ant installation?
You may also try specifying CLASSPATH environment variable with paths to your optional jars using 'System properties and environment variables' screen.
Kind regards,
KIR
I use the ant from my source code... it pulls in all the jars from my dev/lib directory which include ant.jar, bsf.jar, jruby.jar, etc.
I did try specifying the ant home, but it didn't seem to matter. Perhaps I didn't do it correctly. I did it relationally as I'm using Perforce like: /hoth/dev (dev contains the ant.bat file but /hoth/dev/lib contains all the ant jars). I also tried specifying ant home directly to the lib directory, but that didn't work either. I assume when you specify the ant home that it pulls in all jars in the lib directory, correct?
I will also try the classpath suggestion.
Perhaps it would help if you guys did more validation when you enter configuration. for example, when specifying ant home, you could easily check to see if the ant home directory is correct like look for the ant.jar and supporting jars.
thanks!
phil
Unfortunately, that's not that simple. The configuration may be run not on the computer where TeamCity server is installed (we support multiple build agents). Moreover, in ant path you can specify something like %system.custom.ant% and to define variable system.custom.ant on each build agent differently (in buildAgent.properties file).
But as I suppose path like /hoth/dev should work fine in your case. Could you please take a look at buildAgent/logs/teamcity-agent.log file, line "Use Ant home:". There should be the line with this information.
Kind regards,
KIR
I never said it would be easy :) You would have to have each of the build agents do the validation. In my experience expecting people to troll log files for errors leads to all kinds of tech support issues like this one.
Actually I followed your advice and looked at the log file (despite my statement above). Turns out the relational path doesn't work, I had to hard code it to the full path (c:/team city/buildagent... etc) That worked.
Thanks for your help! Seems like that the relational path should work though, so maybe that's a bug?
As long as your expectations were that relative paths would work, that should work :)
Please file a bug to our Jira.
Thanks,
KIR