Eclipse maven EAR project not working after git share - java

I have a working maven project on eclipse which I made using the archetype for Jakarta EE with an ear packaging using windfly 21. (org.windfly.archetype - wildfly-jakartaee-ear-archetype).
After i got a working webpage, i decided to share it on git, using the eclipse GUI. (Right click on project -> Team -> Share).
This moves the project onto another folder, as it says that having git repositories inside eclipse default workspace folder is not recommended.
The problem is that after sharing it, even before I commit or push, it stops working. It stops recognizing packages and I'm unable to make it "run on server".
This is an image of how it looks after I share it on git. I cannot execute "p1parte1" or "p1parte1-ear" anymore (neither any of the other projects/modules), and the other projects below dont have the java classes inside.
I literally have no idea how to fix this, i've spent like 3 hours searching online and trying things.

I solved this by manually fully copying the project that was not shared in the eclipse workspace folder to the git folder.

Related

jar libraries not updated in eclipse with git

I am developing java projects in eclipse and version controlling with git.
What I found today was that the jars of user library was not being updated after pulling a project from git server to another repository/directory. The newly exported jars after adding new classes or functions were not recognized.
So I removed the user library with the problematic jars. The eclipse java project still has access to the jars.
Create a dir.
Git init
Create an empty java project
Pull from git server
The above is the steps that caused this problem. I didnt commit the empty project before pulling.
Thanks~
Have you tried refreshing the project? (Right click on your project and then select Refresh)
Your changes done to the file system (pulling stuff from git) are not known to to Eclipse, so you have to explicitly tell Eclipse that it has to refresh its idea of what are on the file system.

Eclipse Error Logging - Not Showing Because of imported from GIT?

I have just started using the built in GIT functionality of Eclipse and I have everything set up and working, my problem as of now is that I realized my project that I imported from GIT is not reporting errors in my Java like the local copy would. I've tried the following,
Project -> Clean
When I right click on the property files of the folder I can't seem to choose a Java Builder.
It depends on how you import your Java (Git managed) project into the Eclipse workspace.
See "Importing a GitHub project into Eclipse" as an example.
The key is for your Eclipse project to reference the sources in the git repo folder (kept outside the Eclipse workspace folder, in any place you want).

Eclipse renaming function on projects with dependencies

I have two eclipse project. The second one depends on the first one. When I try to rename a java class of the first project (using the rename function on the java file on the project explorer) it correctly do the refactor of that project but it doesn't changes anything on the project that depends on it.
Is there a way in eclipse to tell the renaming function to act even on the projects that are linked to the refactored one? Thanks for help.
My Eclipse version is Juno.
Update:
Forgot to mention that the projects are linked to an SVN repository. Maybe it could be relevant.
Update 2:
I add more details after mliebelt request of clarification.
My Eclipse version is Juno, Eclipse Java EE IDE for Web Developers, build id: 20120614-1722.
I've installed some plugins: subclipse, JRebel, m2e, Eclipse Web Tool Platform.
The second project is linked to the first one as a project dependency in eclipse. I have added the first project in the project tab of Java Build Path. Everything seems to work fine, even the renaming function.
Then, I tried to put the two project in two different SVN repositories. I created two repositories on the SVN server and I installed on my machine the client tortoiseSVN and the eclipse plugin subclipse. Since I didn't succeeded in importing the projects on the server directly from eclipse, I copied the projects' folders in a different location and I removed the projects from eclipse. I used tortoiseSVN to import the projects, each one on a repository with the same name of the project, and than I imported the project back to eclipse. To do that I used the eclipse "import existent project into workspace" function with the "copy project into workspace" option selected. Everything seems to work but not the renaming function.
It does work (for me), so here is what I have done to reproduce the behavior. I hope that this helps to find the error.
Create two projects, and make the second dependent on the first.
Create some source code, so that you can refactor it. Ensure that a class in Test2 is dependent on a class in Test.
Select from the context menu of the method you want to rename. Enter there a new name for the method, only then is the Preview option available. Ensure that Update references is checked.
Press the button Preview to see which classes will be changed by the refactoring.
As you can see, it works for me. Please check what is different in your context:
Define dependency different
Use different refactoring (which possibly contains a bug)
... ?
I then added the two projects to a (local) repository (I use the plugin Subversive, it that matters), and have retried the refactoring, and it works the same way. What is that "it does not work if the projects are in SVN"? The projects have to be in Eclipse, refactoring cannot be done on the Subversion repository directly.
I have made another attempt to reproduce the error, but could not. Here is what has worked for me (no screenshots included):
Installed Java EE from Eclipse (version Indigo)
Installed Subclipse 1.8 from the Eclipse Marketplace.
Defined the 2 projects as before.
Added the projects to the different Subversion repositories by using Team > Share Project...> SVN > select the repository location > Finish
I have then deleted the 2 projects, and instantiated them inside the workspace by doing the following steps:
Go to the SVN Repository Exploring perspective.
Open in the view SVN Repositories your repository locations, and select for each project from the menu Checkout....
The projects will be reinstantiated insided the workspace, and the dependency between the 2 is not lost.
After that, I am able to rename a method as I have shown above.
The problem in my workflow, described in Update2, was that, when I imported back the projects to eclipse, I used "import existent project into workspace" function.
I had to use SVN Checkout Projects from SVN instead, choosing the repositories I previously created.

Importing multiple git repositories into one project in Intellij

I'm moving over from eclipse to Intellij, and I hit a snag on setting up my project
I have 4 projects on github that, in eclipse, all live in one workspace. They are API, Server, Client, and Basic Plugin, and they each have a Maven pom.
What I want to do is set up Intellij's project structure similar to Eclipse's workspace, where all 4 of those projects are side by side in the explorer, but it's not letting me import more than one maven project as a module (I import the first fine, but the rest silently fail), and importing directly from github creates a whole new project for each repository, which is not ideal.
I tried to import a in my eclipse workspace, but it all broke (Object and Math were not found), and all the java environment setting were wrong.
Any ideas? I'm fairly new with Intellij and I really like it, but I don't want to switch over from eclipse if I can't get my workflow right.
First of all, Intellij IDEA uses different naming than Eclipse, you can learn the details here: http://www.jetbrains.com/idea/documentation/migration_faq.html. In short, Eclipse's Workspace is called Project in IDEA, and Eclipse's Project is Module in IDEA. In your case, you want to have multiple Maven-based modules in one Project. You can do it by creating a Project with one Module and then adding the rest of Modules (File->Add Module->Import Module from external model->Maven etc.).
As for the multiple Git repositories, you can configure that using this help page: http://www.jetbrains.com/idea/webhelp/git-branches-in-multirooted-projects.html
In your case, have a look at the 'Asynchronous branch control' section). It's really straightforward, I have just done it myself for the first time by following these instructions.
Good luck.
UPDATE: The above link now gives 404, so here are the most up-to-date ones that may be of help:
https://www.jetbrains.com/help/idea/2017.1/git-branches-in-multirooted-projects.html
https://www.jetbrains.com/help/idea/using-git-integration.html
IntelliJ opens one project at time, but this project can have multiple modules ( say, maven reactor ). So modules are kind of [related] workspace projects in eclipse. You also can open several independent projects in different windows.
In case you have working maven reactor build, you can just open topmost pom as project and everything will be set up. ( treat maven reactor as your workspace )

Source folders for a maven project in eclipse

I have a that uses maven... and I want to put it in my working environment with eclipse(Galileo)... the project is in a svn server, and I can create check out the project and everything looks OK. I even can run the unit test and everything is working there.
However, now that everything is there I wanted to work in the code, and oh surprise there are no packages in my project... I mean all the source code is in the src folder and browsing through it i can see all my files, ut if I open the files from there, the files are opened as text files with no coloring, but worst no help at all about errors in compilation.
I don't know what im I doing wrong now, because I had the same project in other machine and it was working well.
So here is what I did, please let me know if you notice if I did something wrong, miss any steps or anything that can help me:
In the SVN Repository (Using subclipse 1.6.10) I added my SVN Repository
Browsed to the folder where I have the pom file
Right Click> Check out as a Maven project...(Using m2eclipse 0.10.020100209)
Used the default options and finish.
The projects were created with no problem. I said projects because this maven project has modules, and each module became a project in eclipse.
Back in the java perspective, Right click in the project, Run as > maven test(Using JWebUnitTest, because I am testing a servlet)
BUILD SUCCESS!!
But as I said there is not packages so I can't really develop in this environment.
Any help??
Thanks!
When performing a svn checkout as maven project, m2eclipse writes what it does in a console window, accessible using the "console" panel, where there is a drop-down list of all available consoles. What does this console tells ?
Besides, if you can perform a maven test, you can also, in the maven menu (of your contextual menu) do a "update project configuration" which should do the same thing and configure eclipse for your project.
As a last test, is there a maven icon over your project ?
Have you tested your setup on command line with Maven ? Does a mvn package work without errors ? The location for the sources in Maven is src/main/java + Package name. Have you opened the project as a Maven project?
Thanks for your help, however I noticed that eclipse itself was behaving weird when I try to create a package there and I didn't have the option.
So I found out that for some reason that eclipse installation wasn't giving me any of the Java basic options.
So I download a new eclipse installation.. and I repeat the whole process and now is working...
No clue what was the problem with this eclipse because I was using it for other projects and I don't know when I lost the basic functionalities!
Thanks anyway!

Categories