I am trying to use the ":spring-security-core:2.0-RC2" (using Grails version 2.3.1), but have my own LoginController.groovy. Following Burt's notes (here and here), I copied the LoginController.groovy from the original location at "myapp\target\work\plugins\spring-security-core-2.0-RC2\grails-app\controllers\grails\plugin\springsecurity" to my project location at "myapp\grails-app\controllers\com\company". Now I get a bunch of import error messages like "Groovy:unable to resolve class ..." (I have attached am image below showing all the imports giving errors). How do I take care of these errors?
Sorry if this is a trivial question (still getting used to Grails), and thank you for the help!
It looks like GGTS/STS isn't entirely aware that the plugin is installed, since those classes are from the two jars that the plugin depends on. Try right-clicking the project node in the tree and running Grails Tools > Refresh Dependencies. If that's not enough, run Project | Clean to force a full recompile.
Related
I'm creating a hello world type of application using Royale 0.9.6 and Crux. It's my first time trying out Crux and I've been using the examples provided within the Royale sdk to move forward. Unfortunately after setting up everything the compilation fails with the following error:
java.lang.RuntimeException: Unable to find JavaScript filePath for class: mx.rpc.AsyncToken org.apache.royale.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:643)org.apache.royale.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:672)org.apache.royale.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:672)org.apache.royale.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:672)org.apache.royale.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:672)org.apache.royale.compiler.internal.graph.GoogDepsWriter.buildDB(GoogDepsWriter.java:325)org.apache.royale.compiler.internal.graph.GoogDepsWriter.getListOfFiles(GoogDepsWriter.java:113)org.apache.royale.compiler.internal.codegen.mxml.royale.MXMLRoyalePublisher.publish(MXMLRoyalePublisher.java:446)org.apache.royale.compiler.clients.MXMLJSCRoyale.compile(MXMLJSCRoyale.java:441)org.apache.royale.compiler.clients.MXMLJSCRoyale._mainNoExit(MXMLJSCRoyale.java:265)org.apache.royale.compiler.clients.MXMLJSCRoyale.mainNoExit(MXMLJSCRoyale.java:222)org.apache.royale.compiler.clients.MXMLJSC._mainNoExit(MXMLJSC.java:369)org.apache.royale.compiler.clients.MXMLJSC.mainNoExit(MXMLJSC.java:304)org.apache.royale.compiler.clients.MXMLJSC.staticMainNoExit(MXMLJSC.java:262)org.apache.royale.compiler.clients.MXMLJSC.main(MXMLJSC.java:244)
Then there are multiple error lines saying that multiple "mx.rpc" classes on which Crux depend cannot be found.
I'm wondering if I'm missing an import or something but I can't figure it out.
Thank you,
EDIT: Here are some simple steps to reproduce:
Open Moonshine
File > New > Royale Browser Project
Type any project name and create the project
Compile (CTRL + J): compilation successful
Open the main mxml file src/[appname].mxml
Add xmlns:crux="library://ns.apache.org/royale/crux" to the <js:Application> opening tag.
Add the following: <j:beads>
<crux:Crux>
</crux:Crux>
</j:beads>
Compile (CTRL + J): compilation fails as described above.
I just looked into Moonshine IDE project files in examples available in Royale repository. They were broken - I have fixed them so you can wait for Nightly build and download new SDK along with examples or just use checkout source code.
When you open any of those examples, right click in Moonshine choosing Settings and you should check Build Options - There will be many additional compiler parameters, but in your case probably it is enough if you put in "Additional Compiler Options" +configname=flex
Looking at the screenshot it looks like you're using <j:beads> but haven't declared the <j:> namespace. Try using <js:beads> instead.
I am trying to get started with Logary. I need to write a new target and I have tried following the following tutorial https://logary.tech/tutorials. I have downloaded Logary.sln from https://github.com/logary/logary, but I am not able to build Logary.sln. When I build it I get 40 errors and all of them say: The command ""paket.exe" restore" exited with code 9009.
When I try to add the nuget Logary (latest 5.0) with NuGet manager I get NU1108: Cycle detected. Logary -> Logary (>= 5.0.0).
When I try following this https://logary.tech/logary-dotnet-quickstart I get 2 errors as well.
So, I am totally lost. What am I missing out? I will provide more information if necessary. I want to write a target in F# for my .NET application that would be sent as an event to Logary's centralised event storage.
I have used FAKE build and it worked OK. The problem was cause by some namespaces, which is fixed in the fake.
I seems that the problem is with the project name. Its name is the same as the referenced NuGet package. So to resolve this problem you should changed the project name and the build will succeeded.
While following tutorail - Angular-dart tutorial - Tour of Heroes - part 2
with using IntelliJ IDEA in Windows 10 while using chrome, I got following error(s) -
[SEVERE] build_web_compilers|entrypoint on web/main.dart (cached):
Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).
Please check the following imports:
import 'package:angular_app/app_component.css.shim.dart' as import0; from angular_app|lib/app_component.template.dart at 12:1
[SEVERE] Failed after 1.3s
Serving web on http://localhost:53323
I have checked multiple times & I have replaced all - 5 files - namely
lib/app_component.css, lib/app_component.dart, lib/app_component.html, lib/src/hero.dart & lib/src/mock_heroes.dart from Review the app structure but I am still getting the above mentioned error & -
I could not find any app_component.template.dart
Nor could found any instance of imported package:angular_app/app_component.css.shim.dart or shim using IntelliJ Find in Path (Ctrl+Shift+F)
I have tried to delete build and rebuild.
I have also re-installed dart 2.1.0 using windows package manager & changed the location of dart-sdk accordingly in IntelliJ IDEA Settings/Dart, as for brief period I was getting dart-sdk error, but that is fixed.
This my first time asking question on stacksoverflow, but I have checked similar questions, could not resolve that issue.
the most likely reason for that build failure is due to the stylesUrls files not being found. This could be because the name in that array doesn't match the name in the file system or is not the expected place in the file system.
To confirm, I started from scratch, downloaded the quickstart-master.zip to get the project structure.
And followed the steps all the way through the step you were stuck on.
The only time I was able to generate that error while following the steps is when I added thestyleUrls: ['app_component.css'], to app_component.dart prior to creating the file.
I got the same:
[SEVERE] build_web_compilers|entrypoint on test/app_test.dart.browser_test.dart:
Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).
Please check the following imports:
import 'package:angular_app/app_components.css.shim.dart' as import0; from angular_app|lib/app_component.template.dart at 12:1
Once i created the css file, the error went away and everything worked fine.
I completed the entire step you were up to and my app was working fine.
I then did as you did and copied each file from the step and replaced my work with it, still worked.
So confirm my hunch, i changed the name of the css file, and received the same error.
regarding app_component.template.dart that file is auto generated by dart and can be found in your project under .dart_tool/build/generated/angular_app/lib
I had a very similar problem. I ran webdev build and then webdev serve and it fixed it right up.
My goal is to use the hosebird client provided by Twitter to stream tweets in my Grails project.
I'm really not sure how I will approach this, but I first tried including it in the dependencies in my BuildConfig.groovy like this:
dependencies {
compile 'com.twitter:hbc-core:2.2.0'
}
And then, when I tried to mimic the example code, FilterStreamExample.java, in my TwitterService.groovy, GGTS (the IDE) just shows me errors as I write these lines of code:
import com.google.common.collect.Lists
import com.twitter.hbc.ClientBuilder
import com.twitter.hbc.core.Client
import com.twitter.hbc.core.Constants
import com.twitter.hbc.core.endpoint.StatusesFilterEndpoint
import com.twitter.hbc.core.processor.StringDelimitedProcessor
import com.twitter.hbc.httpclient.auth.Authentication
import com.twitter.hbc.httpclient.auth.OAuth1
Obviously, this makes me unable to run the code because of the compile time error. It just tells that the error is something "Groovy was unable to resolve".
Can you tell what am I missing?
Is it just a groovy syntax error that I'm not noticing? I'm new to Groovy so please bear with me.
OR
Is the problem here is in the inclusion of the library in the dependencies?
My first aim is to be able to use the library this way as I have told it above (the BuildConfig way) before trying to make jars and put it in the src/java. Who knows, the compile time error will appear too. I just want to know if the current obstacle in the approach I did is easy to fix.
GGTS and STS don't parse BuildConfig.groovy - they get all classpath information from Grails. When you update BuildConfig.groovy with a new plugin or jar dependency, right-click on the project node in the tree on the left and select Grails Tools | Refresh Dependencies and GGTS will rebuild its classpath based on the current state of the app.
I got this problem several times: Sometimes when I command : grails run-app, the compiler just running again and again, even though I change nothing after that. It looks like:
Running Grails application..
Server running. Browse to http://localhost:8080/LiningTest
[groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes
[groovyc] Compiling 2 source files to E:\workspace\W1\LiningTest\target\classe
s
[delete] Deleting directory C:\Documents and Settings\Long\.grails\1.3.6\proj
ects\LiningTest\tomcat
Running Grails application..
Server running. Browse to http://localhost:8080/LiningTest
[groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes
[groovyc] Compiling 2 source files to E:\workspace\W1\LiningTest\target\classe
s
[delete] Deleting directory C:\Documents and Settings\Long\.grails\1.3.6\proj
ects\LiningTest\tomcat
Running Grails application..
Server running. Browse to http://localhost:8080/LiningTest
[groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes
...
The compiler succeeded when "Server running", but then it automatically re-compile some files (I don't know which file), and run again, and then recompile again...
I have met this problem once when I have a syntax error
constraint {
number(min:0.50) // the right way is "min: 0..50"
}
The question is why this problem happened, and how I can find the cause of the problem. (I guess that I miss some comma/dot somewhere, but now it's hard to find, because of there's no error message!)
UPDATE: Now I see the problem is that I don't follow the folder structure rules when placing non-domain class in src/groovy.
The first thing to do is to run:
grails compile -verboseCompile
That will at least tell you what the problematic file is.
Apparently this can happen when
The package name does not match the directory (under your source root) the file is in.
The class name is different from the file name.
Have a look at this:
http://www.pubbs.net/201007/grails/58100-grails-user-groovyc-causing-grails-to-loop-.html
And Peter Ledbrook mentioned it in his talk at the Groovy & Grails Exchange last week (at 29:20):
http://skillsmatter.com/podcast/java-jee/talk-by-peter-ledbrook
I can confirm the strange behaviour.
I had two groovy classes in src/groovy belonging to some package com.acme.foobar.
Although for a while all went fine and Grails even compiled the classes and started the application (which was useable without exceptions) - at some point it did not stop to compile, start, delete all over again.
After I put the classes in src/groovy/com/acme/foobar the behaviour stopped instantly.
The remark of using grails compile -verboseCompile was useful. At least you can check if everything is allright as follows:
Call grails compile twice:
If there is the same output of classes being compiled the second time you compile there will be a problem.
If grails splutters something like this:
Running script /Users/ug/Software/grails/scripts/Compile.groovy
Environment set to development
returning to prompt directly afterwards - the problem should be gone.
Ok, it's a strange behavior with Grails that a senior programmer just told it to me:
I put one of my non-domain class in src/groovy/warm.groovy. But the warm.groovy belongs to the package "liningtest". It seems that I must put "Warm" class inside "src/groovy/liningtest/warm.groovy" instead.
There's an implicit rule here:
The non-domain class put in src/groovy, must follow the folder structure that is alike to the package structure.
That's really a strange behavior, because it doesn't report any errors, just repeat compiling again and again... And for the most strange part, that works for me in the first time!