I'm running Eclipse Neon.2 Release (4.6.2) and was in the middle of a Spring Boot course when an Eclipse update killed my Workspace.
After many hours of research on -clean, eclipse.ini edits, etc I decided to start a new workspace. I have a local repo created on the HD and subclipse 1.10.13 plugin installed, so I knew my actual project was safe.
Problem is I can't get Maven to recreate the original structure of the project with the new project wizard (assuming this is what I need since a straight checkout was missing many directories/files. Using the wizard the structure is still off and it creates a duplicate pom.xml file.
How do I get Maven to recreate the structure the way it was without creating a duplicate pom.xml?
You can try to right click on your project, then from the context menu, click Configure > Convert to Maven project
Did you tried to start your Eclipse and Workspace with the start parameters -clean -initialize
Related
Let's say I have a few java projects on an SVN repository. If I want to check them out in an eclipse workspace at the moment, I first need to check out the projects in the workspace, then import them as gradle projects using Eclipse Buildship.
If I try to check them out using the new project wizard, it seems to just initialize another gradle project on top of what's already there, leaving me without the files I was trying to check out in the first place. What I would like is to be able to directly check these out as gradle projects, in a one-step process as opposed to checking them out and then re-importing them into my workspace. Is this possible? If so, what plug-ins or gradle build configurations are necessary to achieve it?
Right-click on your project at Project Explorer -> Configure -> Add Gradle Nature should change your project's configuration to a Gradle project without creating any configuration file.
I am new to github. I tried to clone a repo and then pull the files on my computer. All the other team members did the same thing and it worked for them. When i open the project with Intellij all the .java files look like this:
files
It also says that my SDK isn't set.
I tried to set my SDK, and also i tried to set the java directory as 'sources root' because someone said that is a problem with the project structure.
These problems disappeared but then IntelliJ didn't recognize that my project is a maven project so i had to add manually the file pom.xml and refresh maven.
Then this problem disappeared but i had another:
"Cannot start compilation: the output path is not specified for module 'cmsiss'.
Specify the output path in Configure Project."
I tried to set it from project structure but now I have this error:output error
Please help.
Open maven project using pom.xml file. File->Open->pom.xml
Sources should be pointed to project root, not java directory.
Give these a try.
The usual steps that I follow to open the project:
git clone <github clone url>
Open the project in intelli J using
File<Open
and browse to open the root of the project.
This should work fine but if it does not, a few more things you can try:
Try making the project root as a maven module
You can open the Project Structure to make sure you have Java SDK set up properly. It should show the java version you are using there.
Worst case, that is if nothing else works and if the project is not too big, just create a new maven project and make sure it runs, then add all the project files.
I pulled the project again and started from zero. I specified the SDK and then I opened the Maven project window and added a maven project (selected the pom.xml file) and refreshed it. Maven did it's job and created the project structure and all the stuff I've tried to do manually and finally worked!
So I am trying to do something slightly unusual.
I checked out a project using Tortoise SVN, and then I imported that project into Eclipse as a Java project, and I can build the project fine.
But I would much rather use Eclipse's Subversion plugin than Tortoise SVN to check in files, update, compare diff's etc.
So is there any way I hook that Java project back into SVN in Eclipse, and then be able to check in files etc through Eclipse.
Note that checking out the project again using Eclipse is not an option for a few different reasons.
Thanks.
Right click on the Project and select 'Team > Share Project...' to set up SVN on the project.
I found an annoying issue working with m2eclipse in Eclipse.
My workspace contains 2 projects, an application A and a library B. The application A POM has B as a dependency and everything works correctly. (The project dependecy is found and used when I build the application)
But if I change some code in project B and I forgot to mvn:install it, when I build the application it uses the last built version of the library and it loses my last changes.
Is there a way to force Maven / M2Eclipse to check if the source code of the dependecy is newer than the last version built, and to install it when installing/ deploying the main application?
Or maybe my approach is wrong or is something obvious that I'm missing?
You can tell m2eclipse to use resolve dependencies from the workspace rather than through the normal mechanisms. In your project properties (NOT workspace properties), select Maven->Resolve dependencies from Workspace projects.
This will mean that when you change B and subsequently build A, the changes should be picked up automatically.
If, however, you build outside Eclipse, you'll have to do the normal mvn install to get the correct dependencies.
I don't know of a way to tell maven to build the library first, then build your project. You could put two maven commands into a script and run the script.
Alternatively, you could put both projects inside a maven parent project, and then build the parent. This causes all child project to be built too (so in your case the library, and the application).
I think you have couple of options here
If you can change the maven project set up, I would suggest you to use maven multimodule
Option two might solve your problem but still involves a manual stop when you change your dependent project B, Do this on for your dependent project in eclipse
Select Library B ==> Properties ==> Maven ==> in the input box under Goals to invoke after project clean: ==> enter : install
To deploy any change that you made to Project B in eclipse to maven local/remote repo, You have to run Clean build in eclipse, This will deploy the latest Library B to the maven repository
Also make sure your Library B version is a SnapShot during the development
If you are looking to run the latest snapshots on your local machine you should try to set things up to launch directly from Eclipse.
Apart from avoiding the problem you originally posted about, it also has other advantages.
It will save you a lot of time by not having to perform intermediate build steps.
You can start and stop servers without having to leave your IDE.
The Eclipse console has extra features that you don't get from the system console.
You don't have to modify your start scripts to attach a debugger.
I have an eclipse project structure that looks something like this:
eclipse
project a
project b
All of these projects are Maven projects. Project B is an Eclipse WTP project and contains Project A as a dependency. I'm using the m2eclipse plugin.
When I deploy Project B to Tomcat (all from within Eclipse) it always throws errors saying that it can't find classes from Project A. The only way I can resolve this is to close Project A in Eclipse and do a mvn install command, so at this point Project A is treated like any other dependency.
I would like to not have to keep reopening and then closing Project A every time I make changes to it (which is pretty frequently at this stage).
I have tried adding Project A to Project B's Build Path, however that doesn't seem to do the trick. Again, it only works if I close the project in eclipse so it's treated like a normal maven dependency.
FYI I'm using the Helios version of Eclipse. Project B is a Spring project, so naturally Tomcat falls over when it imports all the beans etc.
Does anyone have any suggestions? Thanks a lot.
What you need to do is this:
In Eclipse go to Window > Show View > Servers > and open tab called Servers
In Servers, double click the server you want
This action should open a window entitled Overview, with your selected Server in the TAB
In this window select: Open launch configuration, and click the link.
In the Edit Configuration window, select the tab called Classpath
In the ClassPath textbox, select the line: User Entries
Now push the button on the right entitled: Add Projects
In the resulting Project Selection window select the external project you want the server to find via click.
Close these windows by clicking Apply then OK as appropriate as you work up the stack
Restart your server in the Overview window
You should be ready to go. It's actually only a 2 minute exercise. Good luck
If you go to the project properties, pick the item "Deployment Assembly", click "Add..." and choose "Project", you can add the dependent project and the issue should be solved.
The reason that tomcat cannot find your classes is that the project dependency in eclipse is not seen by tomcat. To resolve the issue you can add the bin folder of project a to the tomcat classpath of the app running from project b.
Right click on the web project which is added to container server and select Maven and then select Disable Workspace Resolution. Then your dependency project will start appearing as a jar like any other dependencies.
Right Click on the WebProject --> Maven --> Disable Workspace Resolution.
Have you installed the m2eclipse extension that know about WTP? Without it m2e will not work correctly for WTP projects. See this:
https://docs.sonatype.org/display/M2ECLIPSE/WTP+mini+howto
Simple way :
Run -> Run Configurations... -> Classpath