|
I am using SpringSource Tool Suite 2.8.1.RELEASE and Grails 2.0.1. I am having trouble adding 3rd party libraries to my Grails project. I tried three different libraries and didn't have any success with them. I'm pretty sure that I'm following the same procedure I used with Grails 1.x and Eclipse but it's been several months so I'm not sure. So, for example, I tried adding the following Jackson JSON jars by: 1. Copying these two jars to the "lib" directory of my Grails project:
jackson-core-asl-1.9.4.jar jackson-mapper-asl-1.9.4.jar 2. Opening the "Properties" for the project in STS, selecting "Java Build Path", then selecting the "Libraries" tab. 3. Selecting "Add JARs..." and they were added to my build path: jackson-core-asl-1.9.4.jar - MyApp/lib jackson-mapper-asl-1.9.4.jar - MyApp/lib Grails Dependencies Groovy DSL Support JRE System Library [Java SE 6 (MacOS X Default)] I don't get any errors in the STS editor but when I run the app, I get: unable to resolve class org.codehaus.jackson.map.ObjectMapper @ line 3, column 1. import org.codehaus.jackson.map.ObjectMapper I then verified that this class existed in one of the jars: $ jar tvf jackson-mapper-asl-1.9.4.jar | grep ObjectMapper 7211 Fri Jan 20 17:16:38 EST 2012 org/codehaus/jackson/map/ObjectMapper$1.class 946 Fri Jan 20 17:16:38 EST 2012 org/codehaus/jackson/map/ObjectMapper$2.class 3019 Fri Jan 20 17:16:38 EST 2012 org/codehaus/jackson/map/ObjectMapper$DefaultTypeResolverBuilder.class 1377 Fri Jan 20 17:16:38 EST 2012 org/codehaus/jackson/map/ObjectMapper$DefaultTyping.class 55834 Fri Jan 20 17:16:38 EST 2012 org/codehaus/jackson/map/ObjectMapper.class What am I doing wrong? Or is this a Grails 2.x issue or a STS 2.8.1 issue? Please point me in the right direction. Thanks in advance! |
|
Did you run the Grails -> Refresh Dependencies menu option?
-- Graeme Rocher On Thursday, February 23, 2012 at 6:08 AM, Robert La Ferla wrote:
|
|
Yes, but it gave me an error: Command terminated with an error code (see details for output) ------System.out:----------- | Loading Grails 2.0.1 | Configuring classpath. | Environment set to development..... | Compiling 1 source files. | Error Compilation error: startup failed: ....../Grails2Test/grails-app/controllers/grails2test/CompanyController.groovy: 3: unable to resolve class org.codehaus.jackson.map.ObjectMapper @ line 3, column 1. import org.codehaus.jackson.map.ObjectMapper ^ 1 error ------System.err:----------- Ideas? On Feb 23, 2012, at 5:03 AM, Graeme Rocher wrote:
|
|
Is the jackson dependency declared anywhere?
-- Graeme Rocher On Thursday, February 23, 2012 at 3:50 PM, Robert La Ferla wrote:
|
|
I didn't declare it. Should I have (and if so where)? FYI - I'm not using Jackson directly. I need it for an OAuth library along with Google api client and guava libs.
Robert On Feb 23, 2012, at 9:58 AM, Graeme Rocher wrote:
|
|
jackson is not a Grails dependency as far as I'm aware. It is declared by a plugin you are using then you may get it automatically. If you can run "grails dependency-report" you may be able to see if it is declared by a plugin. Otherwise you will need to declare it yourself
-- Graeme Rocher On Thursday, February 23, 2012 at 4:07 PM, Robert La Ferla wrote:
|
|
To be clear, I am trying to use a 3rd party OAuth library (jar) that requires the Jackson and Google Client API jars. None of these are plugins. They are simple jars. With Grails 1.x and Eclipse, I could simply add any Java jars to the "lib" directory and update the Java Build Path. It appears that the procedure is different under Grails 2.x and STS.
BTW - The Grails dependency report is awesome. I'm still not sure what to do to fix my problem. Thoughts? On Feb 23, 2012, at 10:19 AM, Graeme Rocher wrote:
|
|
What version of STS are you using?
-- Graeme Rocher On Thursday, February 23, 2012 at 4:48 PM, Robert La Ferla wrote:
|
|
I am using SpringSource Tool Suite 2.8.1.RELEASE and Grails 2.0.1. On Feb 23, 2012, at 11:10 AM, Graeme Rocher wrote:
Robert La Ferla Founder ---------------------------------------------------------------- Cloud2Market 711 Atlantic Avenue, LL Boston, MA 02111 mobile: (978) 496-5733 | main: (978) 303-0055 _____________________________________ |
|
In reply to this post by Graeme Rocher-2
Solved.
I needed to add this to the BuildConfig:
dependencies { // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg. // runtime 'mysql:mysql-connector-java:5.1.16' runtime ":jackson-mapper-asl:1.9.4" } Thanks, Robert On Feb 23, 2012, at 11:10 AM, Graeme Rocher wrote:
|
|
Im confused. The way you are doing it now does not use anything you
put in the lib dir no? Or does it? Im stuck with 1.3.7 for now (happily i might add :)) On Thu, Feb 23, 2012 at 9:58 AM, Robert La Ferla <[hidden email]> wrote: > Solved. > > I needed to add this to the BuildConfig: > > dependencies { > // specify dependencies here under either 'build', 'compile', > 'runtime', 'test' or 'provided' scopes eg. > > // runtime 'mysql:mysql-connector-java:5.1.16' > runtime ":jackson-mapper-asl:1.9.4" > > > } > > Thanks, > Robert > > On Feb 23, 2012, at 11:10 AM, Graeme Rocher wrote: > > What version of STS are you using? > > -- > Graeme Rocher > > On Thursday, February 23, 2012 at 4:48 PM, Robert La Ferla wrote: > > To be clear, I am trying to use a 3rd party OAuth library (jar) that > requires the Jackson and Google Client API jars. None of these are plugins. > They are simple jars. With Grails 1.x and Eclipse, I could simply add any > Java jars to the "lib" directory and update the Java Build Path. It appears > that the procedure is different under Grails 2.x and STS. > > BTW - The Grails dependency report is awesome. I'm still not sure what to > do to fix my problem. Thoughts? > > On Feb 23, 2012, at 10:19 AM, Graeme Rocher wrote: > > jackson is not a Grails dependency as far as I'm aware. It is declared by a > plugin you are using then you may get it automatically. If you can run > "grails dependency-report" you may be able to see if it is declared by a > plugin. Otherwise you will need to declare it yourself > > > -- > Graeme Rocher > > On Thursday, February 23, 2012 at 4:07 PM, Robert La Ferla wrote: > > I didn't declare it. Should I have (and if so where)? FYI - I'm not using > Jackson directly. I need it for an OAuth library along with Google api > client and guava libs. > > Robert > > On Feb 23, 2012, at 9:58 AM, Graeme Rocher wrote: > > Is the jackson dependency declared anywhere? > > -- > Graeme Rocher > > On Thursday, February 23, 2012 at 3:50 PM, Robert La Ferla wrote: > > Yes, but it gave me an error: > > Command terminated with an error code (see details for output) > ------System.out:----------- > | Loading Grails 2.0.1 > | Configuring classpath. > | Environment set to development..... > | Compiling 1 source files. > | Error Compilation error: startup failed: > ....../Grails2Test/grails-app/controllers/grails2test/CompanyController.groovy: > 3: unable to resolve class org.codehaus.jackson.map.ObjectMapper > @ line 3, column 1. > import org.codehaus.jackson.map.ObjectMapper > ^ > 1 error > ------System.err:----------- > > > Ideas? > > > On Feb 23, 2012, at 5:03 AM, Graeme Rocher wrote: > > Did you run the Grails -> Refresh Dependencies menu option? > > -- > Graeme Rocher > > On Thursday, February 23, 2012 at 6:08 AM, Robert La Ferla wrote: > > > I am using SpringSource Tool Suite 2.8.1.RELEASE and Grails 2.0.1. I am > having trouble adding 3rd party libraries to my Grails project. I tried > three different libraries and didn't have any success with them. I'm pretty > sure that I'm following the same procedure I used with Grails 1.x and > Eclipse but it's been several months so I'm not sure. > > So, for example, I tried adding the following Jackson JSON jars by: > > 1. Copying these two jars to the "lib" directory of my Grails project: > > jackson-core-asl-1.9.4.jar > jackson-mapper-asl-1.9.4.jar > > 2. Opening the "Properties" for the project in STS, selecting "Java Build > Path", then selecting the "Libraries" tab. > > 3. Selecting "Add JARs..." and they were added to my build path: > > jackson-core-asl-1.9.4.jar - MyApp/lib > jackson-mapper-asl-1.9.4.jar - MyApp/lib > Grails Dependencies > Groovy DSL Support > JRE System Library [Java SE 6 (MacOS X Default)] > > I don't get any errors in the STS editor but when I run the app, I get: > > unable to resolve class org.codehaus.jackson.map.ObjectMapper > @ line 3, column 1. > import org.codehaus.jackson.map.ObjectMapper > > I then verified that this class existed in one of the jars: > > $ jar tvf jackson-mapper-asl-1.9.4.jar | grep ObjectMapper > 7211 Fri Jan 20 17:16:38 EST 2012 > org/codehaus/jackson/map/ObjectMapper$1.class > 946 Fri Jan 20 17:16:38 EST 2012 > org/codehaus/jackson/map/ObjectMapper$2.class > 3019 Fri Jan 20 17:16:38 EST 2012 > org/codehaus/jackson/map/ObjectMapper$DefaultTypeResolverBuilder.class > 1377 Fri Jan 20 17:16:38 EST 2012 > org/codehaus/jackson/map/ObjectMapper$DefaultTyping.class > 55834 Fri Jan 20 17:16:38 EST 2012 > org/codehaus/jackson/map/ObjectMapper.class > > > What am I doing wrong? Or is this a Grails 2.x issue or a STS 2.8.1 issue? > Please point me in the right direction. > > Thanks in advance! > > > > > > > > > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
So, it was working for a moment but now STS is complaining: Loading Grails 2.0.1 | Configuring classpath. | Environment set to development..... | Compiling 2 source files. | Error Compilation error: startup failed: ...MyApp/grails-app/controllers/MyApp/MyController.groovy: The [getRecords] action accepts a parameter of type [com.somecompany.SomeClass] which does not appear to be a command object class. This can happen if the source code for this class is not in this project and the class is not marked with @Validateable. 1 error As to your question (which I find confusing ;-)), do you mean that it's automatically downloading the dependencies rather than using what's in my lib? If so, I don't really know. It says that it's "Downloading" but I took that to mean that it found it in the lib directory and didn't fetch a new lib. I now found this nice article: and subsequently changed the dependencies to use "build" instead of "runtime." Unfortunately, it still doesn't work. What really gets me is that it worked once. I get the error above even when trying to refresh the Grails dependencies. I am still searching for a solution... Thanks, Robert On Feb 23, 2012, at 12:13 PM, Jason Davis wrote:
|
|
For this error you need to make the getRecords method private
Cheers -- Graeme Rocher On Thursday, February 23, 2012 at 6:21 PM, Robert La Ferla wrote:
|
|
Graeme,
That along with the BuildConfig configuration solved it and now my app works. Thank you! BTW - Can you help me with my other question? http://grails.1312388.n4.nabble.com/Grails-2-0-1-Scaffolding-issue-when-adding-objects-to-a-to-many-association-tt4409295.html Robert On Feb 23, 2012, at 12:36 PM, Graeme Rocher wrote:
|
| Powered by Nabble | Edit this page |
