Eclipse loses classpath src entries after Gradle IDE `refresh all` - java

I have an existing Spring web-app that I wish to convert to a gradle project. I downloaded the Gradle IDE plugin and converted to Gradle project. This reset my .classpath and .project files and got rid of my src entries that are neccesarry for my application to run. So no big deal I thought, I would just go in and add them back, which I did. The problem is that when I right click on my project and choose Gradle STS -> refresh all, it resets my .classpath and .project back to how they were without my src entries. How can I prevent this from happening?

Related

Problem updating an external jar in eclipse using gradle

I am having trouble deleting an external dependency from my build path. I have searched this site and the web but have not found a good answer.
I use gradle 4.9 and eclipse 4.7.3a to manage my automated tests. I have placed external jars in a folder named artifact in a git project's root directory.
My build.gradle file contains this line in the dependencies section:
compile fileTree(dir: "./artifact", include: '*.jar')
Well and good, it all works. However, when I try to delete a dependency using
Build Path > Configure Build Path... > Libraries > Project and External Dependencies
all the buttons, including Remove, are grayed out.
I can delete the file from the artifact directory and issue
gradle cleanEclipse
from the command line but when I open Eclipse and try to open the project (under Project Explorer) I get 'Open Project' has encountered a problem. The project description file (.project) for 'project name' is missing.
After replacing the old jar with the new version (different file name of course), I tried running
gradle
which is supposed to recreate configuration files deleted by cleanEclipse. No joy. Next, I tried running
gradle build
But after restarting eclipse, still a failure. The only thing that worked was to delete the project from eclipse and then to re-import it.
Is there an easier way?
Thank you.
Well, I found an answer.
After deleting and copying in the new jar file into the artifact directory, in eclipse, I selected Project > Clean ...
Then I right-clicked on the project and selected Gradle > Refresh Gradle project
I guess writing the question got me thinking about how eclipse handles .project files. Maybe this will help the next person.

Moved project in Intellij and now I can't compile

I am working on a project in Intellij. I started working on it offline and then created a repo where I moved my project in.
The problem I'm having now is that the .idea folder is no longer generated with all the proper files. Also if I add all of the files back to the .idea I am Intellij says that package does not exist for all of the libraries defined in the Maven pom file.
I did not do a refactor -> move inside Intellij but instead just moved the folders manually.
What might be causing this?
Try to reimport the project from existing sources.
File -> New Project -> Project from existing sources.
Intellij will recreate all necessary files.
If this is not enough, remove every single intellij file + .idea folder. Keep only src files and pom.xml. Then Reimport maven project again as described above.

Maven Dependencies showing outside maven folder

Came in the morning fired up eclipse and noticed that eclipse is showing my dependency jars outside the maven dependencies folder. This is a long running workspace and nothing has changed that I am aware of that should cause this behavior.
What's more odd is that the Maven Dependencies folder also has the jars in it as well.
I have tried:
mvn eclipse:clean and mvn eclipse:eclipse which did not work as expected because after this only the parent projects showed as maven folders.
Removed the old workspace and recreated which results in the exact same issue.
Verified maven settings and my poms are good. Which should be.
It looks like some generated files got hosed up. Still not sure what caused the issue...
My solution was to close eclipse, delete the workspace and in the SVN repo made sure all my work was committed.
Right Clicked > Svn option > Revert on an empty screen.
In the gui there was a delete un-revisioned files check box.
This was essentially to get rid of all the maven/eclipse generated files but the target folders go too.
Re-created the workspace imported my maven projects and all cleared up.
The only way I have experimented this situation in which the libraries are shown directly within the project's contents is by meeting these two conditions:
The libraries are specifically set into the libraries tab of the Java Build Project window.
The Libraries from external option is unchecked (from the Customize view option in the project's view menu).
Sounds to me as if your .classpath file has been modified. I always recommend to check it in into the source control system (along with the .project and the rest of metadata files of the Eclipse project), taking care just not to include absolute paths.

Eclipse project and Maven pom file not in same directory

I have a project in Eclipse for which the Pom file(pom.xml) and Eclipse project file(.project) are not in the same directory. The Pom file is next to the source code.
The project resources in Eclipse are defined as Linked Resources(http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fconcepts-13.htm).
I added the pom file as a Linked Resource then and converted the project in Eclipse to a Maven project(Configure -> Convert to Maven Project).
Unfortunately Eclipse is not showing the Maven Dependencies for that project and these are not resolved. Just having the Eclipse project file next to the pom and resources works well for that project but I cannot eventually use it(it's a company rule).
Tanks a lot in advance for your help
Unfortunately Eclipse is not showing the Maven Dependencies for that
project and these are not resolved.
Yeah, and I believe that the Eclipse project files are not going to pick up your changes when you convert to a maven project. This is simply the way maven works because you have the .project file elsewhere.
One note may be helpful: it is generally considered bad practice to check in your .project & .classpath files into src control, no matter where they are located. Can you try and have those files removed from source control and generated for each developer locally.
Personally, I always do that when I first create the Eclipse workspace by creating my project from the pom file: File -> import -> Existing Maven Project and then I browse to the pom.xml file. My understanding is that this is (for many) the preferred way to create the java project in Eclipse.

Issue on removing jar from deployment assembly in eclipse

hi guy iam facing a problem in my Liferay Eclipse project. I have included in it some required jar files using Right_click_on_project -> Properties -> Deployment Assembly.
when i try to remove them using the same procedure an clicking on Apply button they are removed. but when i come back again the deleted jar figure again. doing and doing again the result is always the same: the jar are not removed!
how to delete those jar as they are not needed anymore in my project? i tryed to manually delete them. but their entries always figure in the Deployment Assembly with yellow mark.
Ian using eclipse Luna with liferay plugin 6.1 and Ivy.
i figured how to get rid of those jar file.
i went to the directory liferay_sdk -> portlet -> eclipse_plugin_project_name -> .settings
and then i deleted entries relative to those included jar file in file org.eclipse.wst.common.component.

Categories