I was trying this from one of our Linux server machines that is in our NOC
and behind a firewall (and presumably a proxy?) and the Grape get did not
work.
-Dhttp.proxyHost=myproxy -Dhttp.proxyPort=3122
) then it should work from behind your proxy. Ivy just uses HTTP, so presumably if you can access repository.codehaus.org from your browser, you should be able to use Grape. (Look at your browser's proxy settings :)Trying it directly from my Mac worked fine. I'm not sure what do after
the Grape get, though, as it puts a bunch of jars in the maven repository on
my machine (but I'm not using Maven to build anything). Not sure how to use
Grape, really.
I couldn't embed it, either, since it has to annotate a
method, right? I could make a method in my script, of course, but I
currently don't explicitly have one.
I'm mainly running groovy scripts and jars as needed by adding them to
either the groovy home/lib dir or another directory that I have in the
classpath. So, getting all the dependent jars that you identified was a
great help. Thanks.
On Thu, May 6, 2010 at 9:12 AM, Bill Wright <bi...@wwwright.com> wrote:I was trying this from one of our Linux server machines that is in our NOC
and behind a firewall (and presumably a proxy?) and the Grape get did not
work.
Grape is actually a Groovy wrapper around the Ivy package manager (which is sort of an alternative to Maven.) I think Ivy will respect your Java proxy system properties (i.e.-Dhttp.proxyHost=myproxy -Dhttp.proxyPort=3122
) then it should work from behind your proxy. Ivy just uses HTTP, so presumably if you can access repository.codehaus.org from your browser, you should be able to use Grape. (Look at your browser's proxy settings :)
Trying it directly from my Mac worked fine. I'm not sure what do after
the Grape get, though, as it puts a bunch of jars in the maven repository on
my machine (but I'm not using Maven to build anything). Not sure how to use
Grape, really.
The @Grab annotation downloads the dependencies (if they haven't been downloaded once already) and more importantly puts them on the classpath. This is particularly handy for scripts so that you don't need to have a long -cp command line to invoke the Java runtime with all of the JARs on your classpath.
I couldn't embed it, either, since it has to annotate a
method, right? I could make a method in my script, of course, but I
currently don't explicitly have one.
As of Groovy 1.7 I believe you can put an annotation on just about anything, so the @Grab annotation can come at the top of your script even before your import statements -- which makes the most sense for a Grab annotation if you ask me. If you're using Groovy 1.6, you can just add a dummy method near the top of your script like:
@Grab(.....)
def grapeDummy() {}
I'm mainly running groovy scripts and jars as needed by adding them to
either the groovy home/lib dir or another directory that I have in the
classpath. So, getting all the dependent jars that you identified was a
great help. Thanks.
Yup, that's certainly another option. You just have to be careful about putting _too_much_ there since eventually you'll end up with two libraries in ~/.groovy/lib that are incompatible (e.g. depend on different versions of the same library X). Also the Grab annotation allow you to pass the script to any other user who can run the script without making them manually download anything dependency JARs first.
-Tom
Hi Groovy gurus,
Can someone who's a bit better with Windows (XP) command line take a look at this and possibly give a hint as to how I can get this working? I've dug, and dug on various web pages, and tried a day and a half's worth of variations, to no avail (can get it to work fine from the command prompt in windows...
def proc = 'cmd "C:\\Program Files\\FileZilla Server" dir && "FileZilla server.exe" /reload-config'.execute()
Any pointers/help would be hugely appreciated :-)
Cheers,
-Chris
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
// 1) Works here still.Even if I put this .execute() line as the first line in the called method [wtsClient.createDesignPackage] it still fails.
//println 'cmd /c "c:\\Program Files\\FileZilla Server\\FileZilla Server.exe" /reload-config'.execute().text
def response = wtsClient.createDesignPackage( newPackName );
// 2) Doesn't work here anymore ???
println 'cmd /c "c:\\Program Files\\FileZilla Server\\FileZilla Server.exe" /reload-config'.execute().text
I'm afraid the problem is not clear - you said that 1) works but 2) doesn't work but what's the difference between 1) and 2)? As far as I see both lines are the same, so, I assume that the change is if they are located before or after 'wtsClient.createDesignPackage()' call, right?
Another question is the meaning of 'doesn't work' - how do you check whether the call works or not? Is it the case that current thread just hangs during 'wtsClient.createDesignPackage()' processing and control flow doesn't reach the second instruction?
I.e. the main idea is to try to work out minimal but complete standalone example that illustrates the problem and post it here because it's rather hard to understand what exactly happens at your environment.