I have to include Groovy classes into existing Java apps , and include Groovy into Ant build.xml file.
What is the best way to configure Ant build.xml for it?
Thanks
Tatyana
I was suggested to update my question, but I am not exactly sure what it means.
Tatyana
Urs Reupke wrote:
Please update your question to help future answers bec...
I wanted to grep for java process and then find the max heap memory used.
I tried this
def ex =['sh','-c','ps -aef | grep Xmx'];
String str = ex.execute().text;
while str has something like " java -Xmx1024M /kv/classes/bebo/ -Xms512M"
How do I extract the value 1024M. I was planning to user java regex but thought someone might know a ...
I am just getting started with Groovy on Grails. How do I add Java libraries to my Grails project? I added the Smack library jar to the lib folder of my Grails project, but I still cannot import any of its packages into my Java or Groovy classes. I am using the Netbeans IDE. Any help would be appreciated..
Buzzy
...
When trying to use GraphicsBuilder, I get a java.lang.NoClassDefFoundError for groovy.swing.factory.BindProxyFactory.
This is my environment:
% java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)
% groovy --version
Groovy Version: 1.5.7 JVM: ...
In the grails-framework some objects are using log. This is normally injected by grails. It works on execution of 'grails test-app'. But the same test (an integration-test) fails on execution of 'grails test-app -integration'.
What goes wrong here and can I force the injection of the log-object somehow?
...
I've scoured the groovy doc and haven't found an analogue, but things there are organized a bit haphazardly. I'm switching from beanshell to groovy and was using the source("fileloc") method in beanshell to inline-include other, utility beanshell scripts for reuse. Is there a standard function to do this in groovy or a best practice?
...
It seems like Groovy was forgotten in this thread so I'll just ask the same question for Groovy.
Try to limit answers to Groovy core
One feature per answer
Give an example and short description of the feature, not just a link to documentation
Label the feature using bold title as the first line
See also:
Hidden features of Python
H...
I have a groovy script that needs a library in a jar. How do I add that to the classpath? I want the script to be executable so I'm using #!/usr/bin/env groovy at the top of my script.
...
I have the following entity class (in Groovy):
import javax.persistence.Entity
import javax.persistence.Id
import javax.persistence.GeneratedValue
import javax.persistence.GenerationType
@Entity
public class ServerNode {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
Long id
String firstName
String lastName
}
and m...
Hi,
GWT seems like a really nice technology for Java developers who don't like (or don't know) HTML/JS/CSS to build rich web interfaces. On the server-side Grails also looks really nice, it's often described as "Rails for Java developers". I've read that Grails' "convention over configuration" approach, together with the benefits of dyn...
I'm using grails j2d which in turns uses GraphicsBuilder to make a simple service to scale an image. My problem is specifically accessing the downloaded image height and width attributes in order to pass the correct parameters to the scale method. How do I access these attributes inside the transformations closure?
Controller{
def sca...
While writing a utility script to insert images into a database I wondered if there were a groovier way of doing it. In the end settled for something along the lines of this:
def sql = Sql.newInstance(...)
// ...
Connection conn = sql.getConnection()
PreparedStatement stmt.prepareStatment(...)
stmt.setBinary(...)
stmt.executeUpate()...
I have a MYSQL query that I use to retrieve random rows from a table. The query is :
SELECT * FROM QUESTION WHERE TESTID=1 ORDER BY RAND() LIMIT 10;
Now I need to change this query to Hibernate. Did a bit of Googling but couldn't find the answer. Can someone provide help on this. Thanks
...
I'm a pretty experienced Grails developer, but most of my experience has been with using grails for serving up JSON/XML to a flex app and some relatively simple HTML websites.
I've been diving deeper into using the sitemesh integration in grails and I'm struggling a little to find best practices for some more complex configurations, and...
I am trying to wrap my head around canoo webtest
I setup a simple groovy webtest.
I have even made and run the xml equivalent and I get the same error when it tries to encode the url.
I get an error when I use a context root.
I don't get an error when I just use the url with out the context root. ie."http://somesite.com"
Other th...
I need to get a file into memory in my app from a secured web location. I have the URL of the file to capture, but can't seem to get the security issue resolved. Here's the code from the Cookbook samples page:
def download(address)
{
def file = new FileOutputStream(address.tokenize("/")[-1])
def out = new BufferedOutputStream(...
How do I convert a datetime field in Grails to just date, with out capturing the time? I need to do this for comparison with system date.
class Trip
{
String name
String city
Date startDate
Date endDate
String purpose
String notes
static constraints = {
name(maxLength: 50, blank: false)
st...
I need to grep for lines with bunch of names, say "[email protected]", "[email protected]" from a file.txt
file.txt has junk which is [email protected] [email protected]. I need to filter these out
Once I get these lines I need to grep for gmail and yahoo and get their counts
List l = new ArrayList{[email protected], [email protected]}...
I am looking at using groovy scripts in an existing web application and am busy setting up and configuring the GroovyScriptEngine.
What are the "best practices" for managing the scripts in the container ?
Should I store them in a database
and then serve them up to the engine
via urls ?
I could store them in the
file system on the ser...
I'm having some trouble running a groovy servlet (groovlet) in tomcat that imports a library class. When I don't import anything the groovlet works correctly, but if I do import something that I expect to be on the classpath (I can import the same class successfully in a regular servlet), I see the following error:
groovy.util.ScriptExc...