STS: Different "view" of Packages in Spring MVC vs Spring Roo - Project - eclipse

I'm just starting with having fun with Spring Roo...
Everything is nice so far. But eclipse (STS) sometimes behaves strage.
If i generate a new Spring MVC-Project, the containing Packages are shown as I'm familiar with, in eclipse.
If i generate a Roo-Project, Eclipse just shows the Package-Folders.
How can i fix this?

You can fix this by configuring your Eclipse project to contain Roo generated folder src as an Eclipse Source Folder.
For more information and how to, please see the following article.
http://www.informit.com/articles/article.aspx?p=367962
Figure 6-1 is the dialog where you should add your Source folder.
Cheers!

Related

Importing Netbeans project to Eclipse

I have created a GUI Applicaiton using Netbeans because of several obvious reasons like GUI Builders and all.
Now I want to implement Hibernate as ORM in this app in eclipse , because of the Hibernate plugin that makes it very simple and time saving .
How can i import that Netbeans project to my Eclipse IDE . I know there is no direct solution for this .
I have tried to find (.war) file under dist, but its not there even after clean and build in netbeans. So please tell me a way to make it done .
I also faced the similar problem. What I did was I copied .project and .classpath files (from my other eclipse project or you can create it, I was too lazy) into the netbeans project directory and then simply imported the project into eclipse. now I can make UI changes in netbeans and edit the other part in eclipse.
For the problem of AbsoluteLayout you need to make a classpath entry in ".classpath" file for AbsoluteLayout.jar
Hope that solves your problem.
I also faced a similar problem with my project the best way to solve this issue to do the configuration manually on eclipse. Its tiresome but there is no shorcut way to it..
Goto eclipse and create dynamic webproject
Create the simlar packages
Create same folder in the WEB-INF directory
Paste all the content(Source code, jsp file, js, css etc.)

Spring JAR files not present in new Eclipse Spring project

I installed Spring in Eclipse/EE simply from the Eclipse Marketplace.
However, either the Spring jar files aren't there, or am missing something within the project setup.
I looked to find them in the project library thru "Build path". I even tried searching the .jar files within the Windows directories.
I know I'm missing something big-- please bear with me.
Took me hours.
Note: I saw stackoverflow.com/questions/6288563/adding-external-jar-file-in-eclipse/11004869.
Update: found the jars in an earlier release-- 3.05. OK now i think.
Of course they are not there. There is not reason for them to be in eclipse. Select File > New > Spring Template project. This will create new maven project with spring dependencies included

Creating new PlayN project in eclipse does not have java content-assist

I created a new PLAYN project based on the "Generating a skeleton project with Eclipse" instructions on the wiki
( found here: http://code.google.com/p/playn/wiki/GettingStarted#Generating_a_skeleton_project_with_Eclipse )
Everything was set up correctly but Eclipse doesn't recognize it as a java project so I lose the syntax checking, content assist, etc (I get run-time error dialog box when content assist tries to help) for java.
I get "compilation unit is not on the build path of a java project" followed by "The 'org.eclipse.mylyn.java.ui.javaAllCompletionProposalComputer' proposal computer from the 'org.eclipse.mylyn.java.ui' plug-in did not complete normally...".
Did I miss a step? Is there a way to add it to the project?
I tried editing the .project to add a java nature but that really messed up the project structure constructed by maven. (based on How do Java and Maven builders work together in eclipse?)
I tried adding a java builder to the project properties and looked adding a plug-in dependency in Maven but couldn't figure that out (I'm still learning Maven).
thanks.
Make sure you are writing code in the [project-name]-core Eclipse project rather than the [project-name] Eclipse project.
Searching around internet I found several reasons for this error. In my case the problem was that the project's nature was not Java.
To fix that:
close the project
edit file .project on project's root
Add the following line to section:
org.eclipse.jdt.core.javanature
Done. Open your project and code assist works correctly now.

How to get peer project source in eclipse and maven

creating a parent project with only a pom.xml, and lots of sub projects such as:
my-web
my-core
my-backoffice
etc. is easy, and the sonotype eclipse plugin does most of the work.
However, getting one project to know about the source in the other project seems to be hard. E.g. when you are debugging the my-web project, and step into my-core, eclipse doesnt know where to get the source.
Looking in the Java Build Path in eclipse, the maven plugin has added my-core as a folder under "Web App Libraries". I.e. its not using the my-core-0.0.1.SNAPSHOT.jar or similar, its using the raw java files. Great!
But how to tell maven to tell eclipse to look for the source in the same place?
Im not really sure where to start. Im guessing its possible to get maven to put the source in a special jar using the maven-soure-plugin, but this will usually be out of sync with the actual java files which the web project seems to be using directly.
A quick and dirty solution is to manually Edit the Java Build Path for each project, and add my-core and other dependant projects in the "Projects" tab. Is this best practice? Any other suggestions?
A quick and dirty solution is to
manually Edit the Java Build Path for
each project, and add my-core and
other dependant projects in the
"Projects" tab.
If this doesn't happen automatically you have a configuration problem.
My Guess would be that you have a version mismatch between the pom dependencies and the actual project versions. Or your projects have an unusual name template (m2eclipse resolves projects by their artifactId AFAIK)
Either way, what always helps is in your Debug configuration (Run > Debug Configurations ...) select the Source tab and just Add... the selected projects.

What should I do in order to be able to work with maven + eclipse + wicket + hibernate + spring in Mac OS?

I want to create a web app that will use wicket, hibernate and spring frameworks. My IDE of choice is Eclipse, I am using maven for the .war generation and I am running Mac OS. What steps should I follow to correctly install and configure all the tools so as to have a project running that relies on these 3 frameworks. I was able to successfully set up wicket but I am having trouble for setting up hibernate and spring. I went through multiple tutorials but I still couldn't find the solution.
Thanks!
I will now try to explain a bit what is the problem I can't solve. I first began with a clean project:
mvn archetype:create -DgroupId=test.framework -DartifactId=microForum
Moved on to the project folder and mvn eclipse:eclipse
Imported the project from eclipse
Looked into the apache wicket homepage where there are multiple examples, so I read through the page and that was enough to learn what to add to the pom and had wicket and everything up and running nicely
My next step was trying to use hibernate and/or spring. I thought that "adding" hibernate and spring in the same way I added the wicket necessary configurations and dependencies to the pom (by hand) might not be that easy. So I tried using the maven archetype: appfuse-basic-spring. So:
mvn archetype:generate -> launchs the wizard that lets you choose among different archetypes
After choosing the archetype number 2 ( Hibernate + Spring + Spring MVC) it fails
After googling a bit I found out why it fails (something like I should add a -archetype after appfuse-basic-spring. So, instead of using the wizard, I put:
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring*-archetype* -DarchetypeVersion=2.1.0-M1 -DgroupId=test.framework -DartifactId=microForum2
This created my project (after multiple warnings). I paste a screenshot (Image 1) because some of the information might have some important meaning :
http://img97.imageshack.us/img97/6687/screenshot20100323at112.png
- Image 1
I then did mvn eclipse:eclipse and it started downloading millions of things, which seemed very odd so I Control+C it.
Following schmimd04 answer I tried to use the eclipse maven plugin but I couldn't create a maven project:
Unable to create project from archetype [org.appfuse.archetypes:appfuse-basic-spring:RELEASE]
The defined artifact is not an archetype
Thanks!
p.d: My Mac OS already had maven installed (version 2.2.0), I tried downloading the last one and repeating the same steps but I still had the same trouble.
Bert's recommendation LegUp, jweekend.com/dev/LegUp, have worked just fine for me. I used the wicket + Spring + JPA archetype. I will still look for the reason why maven's Hibernate+Spring+Spring MVC archetype didn't work for me. I'll edit this once I have the answer. For the time being, legup did the job!
Thanks
Install the Maven plugin for Eclipse from the update site: http://m2eclipse.sonatype.org/update.
This will allow you to create Maven projects (I would start with the quickstart archetype) and easily add dependencies, such as Hibernate, Spring, and Wicket.
As Pascal is saying, your question is to broad to answer. A few pointers that might help you:
use 'mvn eclipse:eclipse' to generate an Eclipse project out of your pom.xml. There might even be a working eclipse project that allows to open a pom.xml as eclipse project. I can't say, i left eclipse behind for good.
spring is 'just' a library that need to be in your classpath. the above command will ensure it is there (if it is defind as dependency in the pom.xml) You need to define a applicationContext.xml for Spring that resides in your classpath. See the Spring documentation for that.
hiberate is similar, it is just a library that needs to be in the classpath and that needs to find a config file. in there, the connection to the database is described. See the hibarnate docu (or one of the many blogs out there) for more info.
If you are stuck with a particular problem, please describe it so people can help here.
Bert
I don't know if it sounds odd. But it is because you have archtype data in your .metadata for respective workspace. If you delete the workspace. You can create new archtype. I know deleting worksapce is not a good idea. But still it works.