03 May 2010, 17:39
Generic-user-small

Liam O'Regan (1 post)

Hi Dan, I got your book at the weekend and I’ve just started reading it. I downloaded eclipse, maven and naked objects as recommended in chapter 1. I imported the templates and then tried runnng the application “Claims” but I got an error message :- “Could not find the main class:org.nakedobjects.runtime.NakedObjects”

Liam

04 May 2010, 07:58
Danhaywood-2011-282x282_pragsmall

Dan Haywood (131 posts)

Hi Liam, Well, let’s see if we can sort the problem out for you!

Presumably you also imported the claims app - do you see the six projects (they’ll be called something like claims, claims-commandline, claims-dom, claims-service, claims-fixtures, claims-webapp) in the Package Explorer view? If so, are they compiling ok? If so, how did you try to run the application - did you use the eclipse .launch files in the commandline app?

If you go to my blog then there’s a screencast showing how to do the import and the running the app, see http://danhaywood.com/2009/09/17/naked-objects-example-claims-app-and-other-resources/.

Tell us how you get on.

Dan

04 Jul 2010, 11:49
Generic-user-small

Andrew Moores (4 posts)

Hi Dan

I also have Eclipse build problems with the claims example. I’ve tried with Galileo and Helios releases of Eclipse and the 0.10.2 m2eclipse plugin. I’m running on the Mac.

First issue I found is that there is no Import Maven project in the General list; there is one in the Maven list so I used that. Once imported I don’t see a project called claims but I do have example-claims which is the multi-module project. Initially all projects have errors and I have to go to the Maven config and tick Support Multiple Maven modules … this allows me to select the Nested Modules on the Maven menu for the example-claims project.

After all of this, and project refreshes, eclipse restarts, etc. The projects still show errors such as:

7/4/10 12:01:18 PM BST: Build errors for claims-webapp; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project claims-webapp: Unable to get dependency information for org.nakedobjects.distribution:claims-fixture:jar:4.0.0: Failed to process POM for org.nakedobjects.distribution:claims-fixture:jar:4.0.0: Non-resolvable parent POM org.nakedobjects.distribution:examples:4.0.0 for org.nakedobjects.distribution:example-claims:4.0.0: Failed to resolve POM for org.nakedobjects.distribution:examples:4.0.0 due to Missing:

1) org.nakedobjects.distribution:examples:pom:4.0.0 ———- 1 required artifact is missing.

for artifact: org.nakedobjects.distribution:examples:pom:4.0.0

from the specified remote repositories: central (http://repo2.maven.org/maven2, releases=true, snapshots=false)

and

7/4/10 12:43:29 PM BST: Missing artifact org.nakedobjects.core:bytecode-cglib:jar:4.0.0:compile 7/4/10 12:43:29 PM BST: Missing artifact org.nakedobjects.core:runtime:jar:4.0.0:compile 7/4/10 12:43:29 PM BST: Missing artifact org.nakedobjects.core:metamodel:jar:4.0.0:compile plus many others.

If I execute a Maven build in Eclipse (right click project and then Run As … maven install) it builds correctly. If I try on the command line it fails with the same errors.

I suspect this has nothing to do with Naked Object and is Maven.

Any help gratefully received.

Andrew

04 Jul 2010, 13:09
Generic-user-small

Andrew Moores (4 posts)

Update. This problem seems to be specific to the Mac. I don’t have the same problem under Linux.

04 Jul 2010, 18:09
Generic-user-small

Andrew Moores (4 posts)

This problem applies to the latest version of the m2eclipse plugin (0.10.0.2). This version seems to be broken for multi-module projects (certainly the Claims project won’t build). Reverting to 0.9.8 of m2eclipse and the problem goes away. Have raised a bug report for m2eclipse.

05 Jul 2010, 23:43
Danhaywood-2011-282x282_pragsmall

Dan Haywood (131 posts)

Hi Andrew,

Thanks for doing this investigation. I’ve not had any trouble on my Mac, but I’ve just checked the version of m2eclipse I’m on and it’s 0.9.8 also. I’m pretty sure that was the version I was using when I was writing the book (which I wrote on Windows).

Thanks again, Dan

09 Jul 2010, 12:15
Generic-user-small

Andrew Moores (4 posts)

Hi Dan

So, a little more investigation and things are clearer. In order to get the examples into Eclipse I had to import the examples folder and not the individual project folders (Claims, Expenses and Orders). There is no need to have the nested modules option enabled Eclipse resolves everything fine without this.

If you want the files to live in your workspace copy the examples into the workspace folder using Finder and then use Import -> Maven -> Materialize Maven Projects. Select the examples folder and Eclipse then resolves everything and the projects appear in Package Explorer. If needed you can deselect some of the sub-projects (for example, deselect Expenses and Orders to just work on Claims). This seems to be the only way to the get a single project such as Claims into the workspace with the latest version of the m2eclipse plugin.

Now I can start working though your book ;-)

Andrew

09 Jul 2010, 12:51
Danhaywood-2011-282x282_pragsmall

Dan Haywood (131 posts)

Hi Andrew, Thanks again.

I think the issue you’ve hit is the same one that was in a previous thread (http://forums.pragprog.com/forums/106/topics/4186). In the midst of that I posted a possible solution (http://forums.pragprog.com/forums/106/topics/4186#posts-15304) which might also solve your problem a little more straight-forwardly… basically changing the parent for the claims project to be something that m2eclipse can resolve from the local repository.

Whatever, you’re on your way. If you hit any further problems or just have a comment, do post here, and I’ll do my best to respond promptly.

Cheers Dan

  You must be logged in to comment