Install grails on ubuntu 13.10 amd64 - grails

I am new to use grails and i use amd64's ubuntu 13.10 . When i use gvm to install grails 2.3.2 successfully then type grails create-app test in my bash, it will appear to be some errors as follow:
Loading Grails 2.3.2
Error Error executing script sun.reflect.GeneratedConstructorAccessor1 cannot access
its superclass sun.reflect.ConstructorAccessorImpl
(Use --stacktrace to see the full trace)
When I just type grails,it will appears so errors:
Loading Grails 2.3.2
| Error java.lang.reflect.InvocationTargetException
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:606)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:235)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:263)
| Error Caused by: java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor1 cannot access its superclass sun.reflect.ConstructorAccessorImpl
| Error at sun.misc.Unsafe.defineClass(Native Method)
| Error at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
| Error at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399)
| Error at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:396)
| Error at java.security.AccessController.doPrivileged(Native Method)
| Error at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:395)
| Error at sun.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:94)
| Error at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:48)
| Error at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
| Error at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
...
I also use gvm to install groovy, but when i type groovy, it also has errors.
what's wrong about it ?

Please execute and allow Permission to the entire Grails folder like this one
Make grails executable have the right permission by just typing
`sudo chmod u+x /grailsdirectory/./grails`
`sudo chmod u+x grails-2.3.4 `
`chmod -R 777 /Your/folder/path/`
If you just want to make the files read and write assign permission to 766 instead.
Dude please re-install grails as follow :
sudo add-apt-repository ppa:groovy-dev/grails
sudo apt-get update
sudo apt-get install grails-ppa
to add grails 2.3.0 //in my case
sudo apt-get install grails 2.3.0
Then Don't forget to set permission to grails folder and executable also and Add the nessary environemnt varibles :
your JAVA_HOME directory setting
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.xx
#your GRAILS_HOME directory setting
export GRAILS_HOME=~/grails-1.0-RC2
#your PATH setting to append the Grails bin directory
export PATH=$PATH:$GRAILS_HOME/bin
And , groovy and grails zip package can also be downloaded and extracted to a folder that you want , thens setpermission and then Open or Insatll STS configure grails and groovy thier and ENVIRONEMNTVARIABLES to run grails from Command Line then That is all pretty simple trust me!
Usefull links :
Usefull Links:

Related

Grails4 url-mappings broken?

Is the url-mappings-report broken?
$ grails -v
| Grails Version: 4.0.0
| JVM Version: 11.0.3
$ grails create-app --profile rest-api UrlMappingsTest
$ cd UrlMappingsTest
$ grails url-mappings-report
| Error Command [url-mappings-report] error: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-5.1.1-bin.zip'. (Use --stacktrace to see the full trace)
Do you confirm you have the same result (if so, is this a known bug)? Or is there something wrong on my end?

How to get the ZFTool working?

The ZFTool isn't working (anymore) on my Debian VM.
$ which zf
/usr/local/bin/zf
$ ls -lia /usr/local/bin/ | grep "zf"
... zf -> /usr/share/.composer/vendor/bin/zf.php
$ cd /usr/share/.composer
$ composer info | grep "zftool"
zendframework/zftool v0.1.0 Utility module for Zend Framework 2 applications.
$ echo $COMPOSER_HOME
/usr/share/.composer
Now when I start it:
$ zf create module Foo
OR
$ $COMPOSER_HOME/vendor/bin/zf.php create module Foo
OR
$ php $COMPOSER_HOME/vendor/bin/zf.php create module Foo
I get this error:
Reason for failure: Invalid arguments or no arguments provided
So I cannot run the ZFTool jobs like config, classmap generate etc.
What is the issues caused by and how to get the ZFTool working?
You're simply providing incorrect arguments as it says. That error is coming from withing ZF2 so you're triggering it, but there's There's no -h option.
try
./vendor/zendframework/zftool/zf.php
or
./vendor/bin/zf.php
no arguments and from within your root directory, you'll get a list of options.

Grails: command not found with Travis-CI

I want to use Travis-CI with my Grails 3.0.9 app. For this I created a .travis.yml file:
language: groovy
jdk:
- oraclejdk7
before_install:
- curl -s get.sdkman.io | bash
- source "$HOME/.sdkman/bin/sdkman-init.sh"
- sdk install grails 3.0.9
- sdk default grails 3.0.9
script: grails test-app --stacktrace
When the Travis-CI service wants to build my application, it ends up with this error:
$ export GRAILS_HOME=/home/travis/.sdkman/candidates/grails/3.0.9/
$ export PATH=$PATH:$GRAILS_HOME/bin
$ ./gradlew assemble
...
(downloading a lot of gradle dependencies)
...
BUILD SUCCESSFUL
$ grails test-app
/home/travis/build.sh: line 45: grails: command not found
So do I have to install Grails somehow else or is it because of a missing/wrong path variable?
I've found a working .travis.yml here:
language: groovy
jdk:
- oraclejdk7
before_install:
- curl -s http://get.sdkman.io | bash
- echo sdkman_auto_answer=true > ~/.sdkman/etc/config
- source "/home/travis/.sdkman/bin/sdkman-init.sh"
- sdk install grails 3.0.9
script: grails test-app --stacktrace
Update:
Use get.sdkman.io since get.gvmtool.net doesn't work anymore.

swagger-codegen custom generator ClassNotFound

I'm writing a custom generator for swagger-codegen. When I attempt to run the generator with
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i path/to/swagger.json -l com.my.company.codegen.MyGenerator -o outputlocation
it fails with
Can't load config class with name com.my.company.codegen.MyGenerator
... list of built-in generators...
at io.swagger.codegen.CodegenConfigLoader.forName(CodegenConfigLoader.java:31)
at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:286)
at io.swagger.codegen.cmd.Generate.run(Generate.java:186)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Caused by: java.lang.ClassNotFoundException: com.my.company.codegen.MyGenerator
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:191)
at io.swagger.codegen.CodegenConfigLoader.forName(CodegenConfigLoader.java:29)
... 3 more
I'm not having trouble with any of the built-in generators.
What I did to get here (following the readme):
cloned the project
mvn package
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar meta -o output/myLibrary -n myGenerator -p com.my.company.codegen
and then the above code
I also tried running mvn package again after making my custom generator (which did not make a .jar file anywhere I could find), and tried creating the .jar file myself. Got the same error.
Also FYI, my confusion was definitely increased by some apparent documentation inconsistencies: expected location for my module differs between here and the classname expected here (end of that section). Also, the command for making your own module specifies modules/swagger-codegen-distribution... when I believe it should specify modules/swagger-codegen-cli.... And the guidance in the project readme doesn't seem very congruent with the custom module readme that is generated here.
I don't normally work with Java, so apologies if I'm just missing something super obvious. Thanks in advance for any help!
After trying a bunch of things / internetting, here is what worked:
java -cp output/myLibrary/target/myCustomCodegen-swagger-codegen-1.0.0.jar:modules/swagger-codegen-cli/target/swagger-codegen-cli.jar io.swagger.codegen.SwaggerCodegen generate -i path/to/swagger.json -l com.my.company.codegen.MyCustomCodegenGenerator -o outputlocation
Here are the steps I had to take start to finish to create a custom generator:
git clone from source
cd swagger-codegen
mvn package
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar meta -o output/myLibrary -n myCustomCodegen -p com.my.company.codegen. This will create output/myLibrary and subdirectories, where you should find myCustomCodegenGenerator.java ("Generator" is appended to the class name you specify in the command). You should also be able to find the mustache templates within the resources subdirectory.
Make whatever changes you want to myCustomCodegenGenerator.java and the templates.
cd output/myLibrary
mvn package
cd ../..
Now generate your custom library: java -cp output/myLibrary/target/myCustomCodegen-swagger-codegen-1.0.0.jar:modules/swagger-codegen-cli/target/swagger-codegen-cli.jar io.swagger.codegen.SwaggerCodegen generate -i path/to/swagger.json -l com.my.company.codegen.MyCustomCodegenGenerator -o outputlocation (building in step 7 should have generated target/myCustomCodegen-swagger-codegen-1.0.0.jar for you)
Notes:
Obviously the cding is based on where I put things, just wanted to be clear on relatively where I was when running commands
If you are just using the default generated base class for your generator (instead of subclassing an existing language), you will get an exception FileNotFound for myCustomCodegen/myFile.mustache -- it's from this optional block which you can just comment out of your custom generator class.
Remember to mvn package your custom module when you make changes
You'll need to include your custom library in the java command. For example:
java -cp path/to/your/jar.com:modules/swagger-codegen-cli/target/swagger-codegen-cli.jar \
-jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar \
{args}
Note that if you are attempting to create a generator in Windows and run it from PowerShell, I had to modify #baylee's steps as follows:
mvn install
and
java -cp 'output/myLibrary/target/myCustomCodegen-swagger-codegen-1.0.0.jar;modules/swagger-codegen-cli/target/swagger-codegen-cli.jar' io.swagger.codegen.Codegen -i path/to/swagger.json -l my-language -o outputlocation

Yeoman generator-generator giving error when running

I am using WindowsXP and tryign to create my first yeoman angular project
I installed npm, yo, grunt-cli, generator-generator etc.
when i run
yo generator
I am getting flowing error
D:\OpenSource\html\generator-jbake>yo generator
_-----_
| |
|--(o)--| .--------------------------. `---------' | Welcome to Yeoman, |
( _'U`_ ) | ladies and gentlemen! |
/___A___\ '__________________________'
| ~ | __'.___.'__ ' ` |° ' Y `
[?] Would you mind telling me your username on GitHub? raj[?]
What's the base name of your generator? jbake
C:\Documents and Settings\hegdera\Application
Data\npm\node_modules\generator-generator\app\index.js:38
throw err;
^ 2636:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown
protocol:openssl\ssl\s23_clnt.c:766:
at Object.proto.sendError (C:\Documents and Settings\hegdera\Application
Data\npm\node_modules\generator-generator\node_modules\github\api\v3.0.0\index.js:30:19)
at C:\Documents and Settings\hegdera\Application Data\npm\node_modules\generator-generator\node_modules\github\api\v3.0.0\user.js:36:29
at ClientRequest. (C:\Documents and Settings\hegdera\Application
Data\npm\node_modules\generator-generator\node_modules\github\index.js:719:17)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1547:9)
at CleartextStream.EventEmitter.emit (events.js:95:17)
at SecurePair. (tls.js:1392:15)
at SecurePair.EventEmitter.emit (events.js:95:17)
at SecurePair.error (tls.js:1012:27)
at CleartextStream.read [as _read] (tls.js:457:17)
Anyone tell me what is the problme ?
I installed generator-generator locally and ran the same command "yo generator" and it worked well.
I tested on Windows XP and Node v0.10.26 , yo v1.3.2.
The error you get has some issues related to proxy/ssl settings. Read this & this it may help resolve it.

Resources