Spring Tool Suite (Eclipse) project run problems - java

So some quick background information to describe my problem. I have a project named Pear that contains a basic Spring project, using Maven. I put this exact project into a SVN repository, and then imported it into this same Eclipse/STS instance under the name of SpringTestRepo.
The problem is, this imported repository contains no Run options that the one I created in Eclipse originally has. For example, in the Pear project, Run -> Run As gives the option to run on an embedded Tomcat server. In the SpringTestRepo project, I have no options - anything past Run As is greyed out.
Another thing that I'm having a problem with in the difference between the two projects is that the one I imported via SVN (SpringTestRepo) has no little 'S' or 'M' by the name of the project. It's also missing several handy annotations, such as a list of methods underneath my HomeController.java class.
Here is a picture to help illustrate my problem.
Any ideas as to how to resolve this issue?
Edit: Just to be clear, it's a little hard to see but just above the Pear project there is a little Maven 'M' and a little Spring 'S' symbol.

I believe I solved the problem! To anyone else importing an SVN project into their STS and having trouble getting it recognized as a Maven/Spring project (the little 'M' and 'S' next to the project name), follow these instructions.
First, to import from your SVN repo after the Subversive Eclipse plugin, click File -> Import -> SVN -> Project from SVN and then press next. Enter in your repository location - in my case, it was svn+ssh://user#domainIp.goes.here/home/user/SvnRepositories/SpringTestRepo. This location will be wherever you are serving your SVN repo from - the beginning of the URL could be svn+ssh, http, https, or several other options depending on how your SVN is set up. Click next, and then click Finish when it asks you which Revision you want to import (I'm importing HEAD, which is selected by default).
A new dialog will pop up, giving you four different choices in the form of radio buttons as to how you want to import your project.
Logically, I tried 'Check out as a project with the name specified'. This is what yielded the picture in my question - a project not associated with Maven. What you need to choose is 'Check out as a folder into existing project'. Exit these dialogs, and create a new Spring MVC Project that you will import that SVN project into. That is File -> New Spring Project -> Spring MVC Project. Once you have created this project, go back through the steps and import your SVN repo project into the project you just created.
This resolved the issue for me. Feel free to edit if I missed anything. Thanks

You need to create a new run configuration. Eclipse doesn't know how to run your web app for you hence why its greyed out.
Check out this for starters:
http://wiki.openkm.com/index.php/Configure_Tomcat_server_in_Eclipse
http://www.codejava.net/frameworks/spring/spring-mvc-beginner-tutorial-with-spring-tool-suite-ide
Once you configure a server you can then select project to deploy to server and run.
Here is another good link to help you out run:
http://www.deepakgaikwad.net/index.php/2009/02/08/spring-mvc-tutorial-with-eclipse-and-tomcat.html

Related

IntelliJ: Why are my libraries not being recognized/downloaded?

IntelliJ newcomer here. I'm having some issues getting my project dependencies working:
So I have a project called ClearDialogue. It's an IDE for making branching dialogue for video games. It relies on my other project, Clear (ClearVG and ClearWindows) for creating its window and also rendering the UI. ClearDialogue also depends on LWJGL3 and a few other dependencies. The projects use Maven to manage its dependencies.
Clear is a project on my machine that I've set up in IntelliJ and successfully ran its demos. ClearDialogue however is where my trouble started; it relies on Clear to work, which is another project (not a JAR thats uploaded for it to fetch). So what I'm saying is: I need to be able to use another IntelliJ project as a library in ClearDialogue.
According to other similar questions, I can achieve this by referencing the other project in the pom file of the project that's referencing it. So I did that and it actually did appear in the "External Libraries" dropdown:
.
There are a few problems:
1) Despite Clear appearing in the External Libraries section, it's still not being recognized by the IDE as a library and when I try to build the project, errors like this are printed to the console:
.
2) It seems that Clear is the only library being downloaded despite LWJGL3 and other libraries being designated as dependencies in the pom file. They aren't being downloaded and aren't appearing in the External Libraries tab. That said, Clear itself uses some of the same libraries (LWJGL3) so is it that it's just making sure they aren't duplicated? Either way, the code itself is drawing red lines because it can't find the LWJGL3 libraries.
Does anyone know ways to fix these issues? Thanks in advance.
I managed to fix both of these problems myself.
To solve the first problem of using another project as a dependency, I was able to use the maven attributes of the projects to do so. I referenced Clear in ClearDialogue's pom file like this:
.
Then I opened the Maven view (View -> Tool Windows -> Maven) and added the pom files from Clear's own modules to the list along with the needed modules within the project itself:
.
After this I pressed the "Reimport all Maven Projects" button (the button in the picture above that looks like a refresh button) and rebuilt the project (Build -> Rebuild Project). This successfully downloaded all of my needed libraries and successfully added the local libraries from my own projects only available on the machine as well. With that I was able to successfully run to program as well.
As for the second half of my problem, I was able to find this answer from another question here on Stack Overflow, which coincidentally was how I was able to figure out how to add local dependencies as well.

Updating Juno to Kepler cause existing project in workspace non functional

does any one know how to over come from this issue ?
I have followed this link but after updating it, every thing seems to correct but my existing projects are not able to run via tomcat (previously in juno it was working). I can see my tomcat server under servers view, when I click on File menu -> New it show No Applicable Item.. I am not even able to create new Dynamic web project, neither I am able to change my project facets from project properties...
Can any one help me out in this case ?
I would go with the answer in https://stackoverflow.com/a/17337692/429972
I always do a clean new install and get the plugins I need again. It doesnt take very long usually.
After you have done that import your old projects in a new workspace.

Can't get basic Hello World Spring MVC project to work

I downloaded and unzipped STS. I then started following the tutorial here that creates a simple Spring MVC application - http://www.javapassion.com/rebels/spring3_sts/
I go to File->New Spring Template Project->Spring MVC Project->(enter project name & package)->Finish
Then I right-click my project->Run as->Run on Server->Finish
I get the following -
I then opened the pom.xml file, which seems to contain the error, and here is what the error it contains -
So does anybody know what is going wrong and how to fix it?
Its very simple Jim. Don't panic.
Just right click on your project and then in Run As click on Maven Install option and go for some refreshments. When you'll come back after some time. Check your console. If it has stopped that means all your libraries needed to run this sample project is downloaded successfully by maven.
After that again right click on the project and go to Run As and click on Maven Clean that should build your project and create a war file for you. And don't forget to check the console that should say Build Successful.
After this just check your project structure. That should not show any red asteric mark anywhere in project.
And there you go. Now you can run your project successfully.
Hope this helps you.
Cheers.

Adding 3 projects to version control (SVN) in Eclipse

I'm currently developing an application, and I have worked in the last weeks with the following 3-project setup :
the code itself;
unit tests;
acceptance tests.
Until now, I had only the code itself under version control. I'm researching on how to include all the 3 projects under version control. I'd like to have everything under the same repository. I've created 3 folders(one for each project) under my SVN repo.
In a new workspace, I've imported each one of the projects into Eclipse. This seems, at first, to be working fine, but I'm not sure if I won't get problems later on when trying to make commits to the server and the different projects aren't in the most recent update.
I'd guess this wouldn't be a problem as they don't share any file, at all, but I'm not really sure. Is this the correct approach for the given situation? How would you handle this?
You create a local project in Eclipse, right-click on it, and select Team/Share project...
Then a wizard will guide you, and allow putting the code into the correct folder of the svn server.

Maven 2 project error icon in Eclipse

I have create multi-module maven project in Eclipse IDE (already installed M2Eclipse plugin). There I can build my project successfully. But after build also it shows errors icon in my every module project. What kind of issue it can be?
Thank You.
Without knowing what errors you are seeing I am going to assume that your issue is with eclipse project properties (build path, src directory specification, output classes directory, etc).
You tagged m2eclipse plugin, so you should be able to right click on your project in eclipse select maven->update project configuration. If you do not see that option under maven then you should first see an option called maven->enable dependency management. Click that first and then you should be able to see update project configuration option.
If this does not fix it, then open your project directory containing the pom.xml file in command prompt and run mvn eclipse:eclipse.
One of the above should resolve those pesky error messages provided that your maven build itself is successful.
In eclipse open the Markers Tab (You can open it from Window -> Show View -> searching Markers)
It will show all the related errors with your project. You can identify your problems related to your problem, and solve accordingly. Sometimes it shows Quick Fix option, which is helpful.
For me, the above solution listed out by #CoolBeans was not working out, so i searched further and found out the following:
Go to Problems windows(present besides of Console window). If it is not there then click on Window-> Show View -> Problems
Inside Problems you will be able to see the Errors Description related to your project. In my case it was "java compiler level does not match the version of the installed java project facet". If that is the case for you as well, just follow below steps:
Right Click Project -> Properties
Click Project Facets(present in the left hand side list)
Choose the correct java version in Java Project Facet
Click Apply
That's it!

Categories