what I have:
an external GroovyScript using the apache-commons-io library
and a working grails application
In the existing grails-application there are different external scripts (as of now only perl-scripts) which are executed async with grails (using the execute-Method).
Now I got an GroovyScript which I want to run the same way as I run the PerlScripts.
At the moment the script has the commons-io-library in a lib-folder. It works fine.
So my question is: How do I provide the groovy-script with the commons-io-library from grails in a smooth and neat way? Do I have to provide the path within the command which is executed via the execute-Method
e.g.:
groovy -cp=path/to/grailshome/lib.jar scripfile.groovy
this won't really work if I deploy the grailsapplication to the tomcat in the current production-environment as the libs from grails are in a different path.
Putting the script into the src/groovy folder of grails would probably work, but that's not the way I want it. The script needs to be standalone.
I'm really stuck as I'm not really versed with the technical details of and groovy grails.
Even suggestions and ideas how this can be accomplished are enough.
I hope you understand the question, thanks in advance
Is this a situation where using Grapes and putting:
#Grab( 'commons-io:commons-io:2.1' )
At the top of your groovy script would help?
If you are running this as a war, then this might work:
String path = grailsApplication.parentContext
.getResource( 'WEB-INF/lib/commons-io-1.4.jar' )
.file
.absolutePath
Related
I'm trying PHPStorm and have trouble with its code completion. I write project with Silex framework and faced PHPStorm's lack of code completion for Silex dependency injection container. For example, it doesnt codecomplete $app['twig']-> or $app['db']-> or any other service. The only way solution I've found is to do smth like this
$db = $app['db'];
/** #var $db \Doctrine\DBAL\Connection */
$db->....
And then PHPStorm will do code completion. Services are registered using ServiceProvider interface.
Is there a way to make PHPStorm do code completion in such cases without additional vars and comments?
As far as I'm aware, this is currently not possible, however, there is currently work going on to add support for generic factory patterns, see this issue on their issue-tracker:
http://youtrack.jetbrains.com/issue/WI-6027
The PhpStorm developers welcome new feature requests on their issue tracker and are quite responsive. So you may file a feature request
Also, this may be related to your question:
http://youtrack.jetbrains.com/issue/WI-5304
Here's a plugin for PHPStorm / Intellij IDEA:
https://plugins.jetbrains.com/plugin/7809?pr=
Didn't tried it yet, but looks promising...
Edit: Just gave it a quick shot, and it looks really cool and simple to set up:
Install the plugin via the IDE plugin manager
Add the following dependency:
"require": {
"sorien/silex-pimple-dumper": "~1.0"
}
Register the provider:
$app->register(new Sorien\Provider\PimpleDumpProvider());
And you are done.
I have 1.3.2 installed. My investigations found this in scripts/DbmDiff.groovy:
// TODO this will fail with JNDI or encryption codec
buildOtherDatabase = { String otherEnv ->
Searching the web lead me to this:
https://github.com/grails-plugins/grails-database-migration/commit/ac38a7310fe48ba7b5c4dda4d6e30dd8040dbeb6
which is code for DbmDiff.groovy, but in spite of the same TODO comment, appears to handle jndi.
Does this mean that a 1.3.3 is coming soon with jndi support? If so, then I can work around for a while using a temporary env using urls etc.
Regards, John
I'm not sure when 1.3.3 will be released since this is the only fix so far. It shouldn't be too soon though. Until then you can copy the current script to your application's scripts folder. Then you run grails dbm-diff Grails will ask you which of the two scripts to run.
I have installed the grails web plugin. I can now browse to :
localhost:8080/myappname/console
And I can see the console displayed over there. I have bunch of test-cases written for application. I wish I can test my app from this web console.
Is it possible to do so? I'm very new to grails.
Thanks in advance.
Short answer no. The grails console is meant to write groovy code that interacts with your running application. Your running application does not include your test cases or the grails command line by default.
Long answer sort of. Provided you have all of your projects source code available somewhere in the file system where your application is running, you could call an external process to run test-app and return the result to the user. Here are some docs on running external processes in groovy: http://groovy.codehaus.org/Executing+External+Processes+From+Groovy. I suppose you could also package you application somehow to make this work, but I think doing that would be fairly complex.
I am not sure this is a good use case for the console plugin over all. Hope this helps
I am a novice with Spring.
I am looking to resolve conflicts between #RooEntity and #RooJpaActiveRecord. I have used the typicalsecurity addon to an existing project which used more recent versions of Roo (#RooJpaActiveRecord). I was wondering if there's a workaround or a specific way to address this issue. I am not able to run the project on the internal web browser. I receive the HTTP Status 404 error.
Any help or suggestions would be greatly appreciated!
#RooEntity is no longer the annotation that you have to use.
Replace it with #RooJpaActiveRecord and run the Roo shell again.
Regarding the web project, the annotations belongs to the spring-roo-annotations.jar (or something like that) that maven puts in your WEB-INF/lib folder when deploying the war application.
You need to have the appropriate jar dependency (I mean, the correct version) depending on the annotation that you have in your code.
In order to see more explanation, maybe you can provide your server stack trace.
I use Dreamweaver heavily for modifying Liferay templates (Velocity files), and then have to run Apache Ant from Command Prompt to deploy the WAR to Tomcat . Is there anyway I can streamline this process so I can save/deploy straight from Dreamweaver?
I tried to setup a site and specify Tomcat as the local server, but obviously Dreamweaver just tries to push the raw file and does deploy the WAR.. Is there some sort of extension or way I can call Apache Ant from Dreamweaver?
Thanks!
I've not seen such an extension, you can search for one at the Adobe Exchange: http://www.adobe.com/go/exchange , however if there isn't one already available, which I suspect there isn't, it would be possible to write one of your own. The following links are for the extending Dreamweaver, and Dreamweaver extensibility APIs:
http://help.adobe.com/en_US/dreamweaver/cs/extend/index.html
http://help.adobe.com/en_US/dreamweaver/cs/apiref/index.html
In this particular case, I believe that you'd need to use an undocumented API call to communicate with an external process (in your case Ant), such as DWfile.runCommandLine() or MM.runCommandLine(). Paul Boon found these and blogged about them and a couple of others here:
http://communitymx.com/blog/index.cfm?newsid=179&blogger=35