Endless builds with eclipse - eclipse

Workspace Settings
Build Options
Does anyone know why eclipse never ends building when I check "Refresh using native hooks or polling"?

Well I just found out that the build creates a jar file in the eclipse project, which triggers a build again and so on...
In case someone faces the same problem in the future:
To solve the problem right click on the folder, go to properties and add a resource filter so eclipse doesn't care about this particular file anymore.

Related

Issues with Liferay 7.1 workspace imported from Github

I have cloned my Liferay 7.1 workspace from my Github repository. When I try to get Assistance in Liferay IDE using Control+Space, I get error:
This compilation unit is not on the build path of a java project
This happens on the new module project created in the same workspace(that was cloned from Github).
But when I create/import module from my local workspace that was created by Liferay for first time, this issue is not there.
I feel like there is some extra workspace setting that I am not doing in my Github workspace. Like we had to create build.username.properties in the SDK folder for Liferay 6.2. Totally stuck and no solutions anywhere.
I tried fixing Project Build path and Project Facets but did not help.
The way you did it in your own answer obviously solved it. My take on this is: The problem was most likely the .project file, because it contains all the configuration that eclipse requires, and the error message you post is an indicator that eclipse doesn't know what to do with these files.
The .project file can be regenerated from gradle settings, typically by choosing "gradle / refresh" (from memory, from the context menu of the project/workspace in Project Explorer), which will read the gradle settings and apply them to the eclipse world. This might happen automatically, but it might also need some manual push - next time you might want to try this, because just copying random files rarely is a good idea. You might end up pointing to other directories far outside of your workspace, and wonder why a local change is not picked up.
There were some differences between the workspace that I imported from Github and the one that Liferay was creating on my local. I opened both the workspaces in Beyond Compare. Following are the files that had major differences. I made them same and it started working after Gradle Refresh in Eclipse.
liferay-workspace/gradle/wrapper/gradle-wrapper.properties
liferay-workspace/.project
liferay-workspace/gradle.properties
liferay-workspace/gradlew
liferay-workspace/settings.gradle

Why does my eclipse project not have a build path?

What is the advantage with not having a build path in eclipse? Why is that setting default when it's like something you'd never use? It seems eclipse indigo was developed to make software development as obscure as possible. I just checked out a fresh copy of the project I checked in (called dungeonworld) this afternoon from another computer and automatically nothing works, can't compile, can't choose build path, can't add jre, can't add jdk, can't add that to project properties.
Is my eclipse broken? I can't believe this is happening, such an easy thing not feasible.
Nothing above solutions worked for me so i tried below
Right click on project >> properties >> project facets >> click on java
It looks like you did not add Eclipse project metadata files to your source control system, so Eclipse doesn't know what your build path is or whether it is even a java project. You can see that the little folder on your dungeonworld project is missing the little 'j', which means Eclipse doesn't think it's a java project.
Go back to your other computer and look for the following files in your original project root...
.project
.classpath
.settings/*
Make sure all of the end up in your source control system or nothing will work right.
I have same problem, but i have solved
project right click -> properties -> java build path -> src/main/sources
all remove items on "Excluded", and then that item turn the status "(None)"
I tried below steps and it works for me.
Right click on project >> properties >> project facets >> click on java
Eclipse has a build path.
It's stored in a (by default hidden) .classpath file in your project.
You can also access it through the UI in project properties (right click on your project, properties, java build path).
Well, this is probably not your problem, but similar is happening if you are in Eclipse different perspective (for example for Python).
vs.
There where no entrys after right click on my projekt in Eclipse. How to click something, wenn build path entries are missing. So my Eclpise didn't detect my java project. I used following Maven command and after that I cleaned the project too. Now Projekt works as expected. So...
If you are using Maven, try mvn eclipse:eclipse in cmd console in your project directory! Make sure to use the path to your Maven folder for the command.
For example:
cd C:\yourEclipseProject\
C:\yourPathToMaven\apache-maven-2.2.1\bin\mvn eclipse:eclipse
This was helping me. After unsuccessful web research, a coworker told me this tip.
I just had a similar problem and I figured out that I had been choosing General Project instead of Java Project while creating a project. After I chose Java>Project it solved my problem. Maybe it'll solve yours as well.
After choosing that, eclipse automatically included java libraries as well.
It's not a good practice to commit IDE related files into source control. What if someone in team uses different IDE? It might have been only option at a time when OP asked this question.
New versions on eclipse (4.x) takes care of this automatically. Probably by observing what kind of source and build files you have in your project.
Don't know the reason. But this works for me, so posting it.
Right click on project -> 'Properties' -> 'Java Build Path'.

Importing Eclipse Plugin source in Eclipse

I have the source code for the VersionOne plugin. I am wanting to modify the code because I am getting a NullPointerException when I click a specific button on the plugin which crashes eclipse. I was wondering what steps I need to take in eclipse to import the source code, modify it, and get it to run. I have read over how to create a new plugin project, but I have never tried importing a plugin before. Plugin Source
Once you have imported the project and that seems to work fine, just run it like any other plugin.
I.e:
Set the breakpoints you want in the code
Click the "Run as..."
In the run dialog start up a new Eclipse instance
On the tab "plugins" make sure your imported plugin is selected
If you are using the plugin at the same time, make sure that the non-workspace is not selected
In the new Eclipse instance, set up a situation that will provoke the bug
You need the following things to do that:
From Eclipse download a distro with PDE (Plugin Development) included.
The source pages
Some configuration management tool like Git or Subversion.
You do then the following steps:
Unzip your sources locally somewhere and add them to the CM system.
Create an eclipse plugin project from that source location (depending on Git or SVN different steps).
Create a run configuration for Eclipse that includes that plugin. That is similar to creating a run configuration for Java, but your Java application is then eclipse (see the Help on Eclipse Application Launcher). You have to ensure that in the "Plug-ins Tab", your new plugin is included. After you have started it, you should see the new feature implemented in the new running eclipse. To debug it, you just have to press the debug button instead of the run button. You may then add breakpoints to the source code of your plugin to see how it is working.
You are then able to start a new eclipse application which includes the plugin and make your tests there. You are able to set breakpoints, debug the code and so on. If you find the error, you can change the code, test it, and as a result have a difference to the source you had initially. The best would be then to make a patch and send it back to the originator.
To deploy it then to others is a different story, and is well documented.

The project cannot be built until the build path errors are resolved.

While compiling an android project in eclipse 3.4.2, I am getting The project cannot be built until the build path errors are resolved.
I got a temporary solution from the blog http://www.scottdstrader.com/blog/ether_archives/000921.html
The resolution was to force a resave of the selected projects (and their .classpath files):
Open the project properties
Select Java Build Path > Libraries
Add a new, arbitrary library (to be deleted later) > OK
Wait for the workspace to refresh (or force a refresh of the project)
The error(s) will go away
Remove the dummy library
The only other references I could find were to make minor alterations of contents of the .classpath file.
Is there any permanent fix for this issue?
Have you tried using Project > Clean... from the menu? This will force a new build on the selected projects in Eclipse.
1-Right CLick on your project folder, Choose Build Path > Configure Build Path
2-Select Libraries Tab and delete any arbitrary library present there.
3-Click on Add Library option, Select JRE System Library and click Next.
4-Choose last Radiobutton option Workspace default JRE and click Finish.
5-press f5 for refresh.
6-run ur program .
This what fixed it for me...
I was having an issue with my spring-core.jar.
I deleted the entire release directory located here. (I'm on win 10).
C:\Users********.m2\repository\org\springframework\spring-core\4.3.1.RELEASE
I right clicked on the project > Maven > Update project and my exclamation mark disappeared. No problems any more.
Here is the source where I found the information:
http://crunchify.com/cannot-be-read-or-is-not-a-valid-zip-file-how-to-fix-maven-build-path-error-with-corrupted-jar-file/
This happens when libraries added to the project doesn't have the correct path.
Right click on your project (from package explorer)
Got build path -> configure build path
Select the libraries tab
Fix the path error (give the correct path) by editing jars or classes at fault
This works for me: close the project then re-open it, this will force eclipse to reload a fresh project and detects the correct build path.
None of the other answers worked for me. Even after fixing my build path issues, doing a refresh, clean, rebuild, and restart (of both eclipse and the computer), I was still getting the little red exclamation point.
I fixed it by closing the project (right-click, close project) and reopening it (double-click the closed project), which seemed to force eclipse to "notice" that the build path problems had been corrected.
For my mac osx Eclipse, I followed following steps:
Right CLick on your project, Choose Build Path > Configure Build Path
Select Libraries Tab and delete any arbitrary library or anything else causing errors in Build Path.
Click on Add Library button, Select JRE System Library and click Next.
Choose last Radiobutton option Workspace default JRE and click Finish.
Clean and build your project.
get a cmd and run
mvn eclipse:eclipse
This is what worked for me:
Go to ~/.m2/repository and deleted everything there by running rm
-rf. Make sure everything is deleted.
Re-launch eclipse or STS
Right click on project -> Maven -> update project.
On my Mac this is what worked for me
Project > Clean (errors and warnings will remain or increase after this)
Close Eclipse
Reopen Eclipse (errors show momentarily and then disappear, warnings remain)
You are good to go and can now run your project
I've seen this problem a few times (got it again right now on my home computer with Eclipse 4.2).
Forcing a resave (by changing the classpath e.g. by adding a library, save, change-back) works temporarily. But the problem comes back when Eclipse is restarted :(
Nuking the Eclipse workspace from orbit will permanently fix it (until next time). But there must be a better way!
just check if any unnecessary Jars are added in your library or not. if yes, then simply remove that jars from your library and clean your project once. Its worked for me.
In Eclipse this worked for me: right click project. -> Properties -> Library Section; Add (any library at all) -> select library and click remove -> press okay.
I ran into this annoying issue with the Play framework. It would be nice if there was some way of knowing what build errors Eclipse is unhappy about, but it's not going to tell you. With one project, I was able to close the project, rebuild the Eclipse configuration with sbt eclipse, and reopen. With an almost identical project, that didn't work. But deleting the project, rebuilding the Eclipse configuration with sbt eclipse, and importing, did the trick.
If you think you've done everything correctly but Eclipse still complains about the jars, refresh the folder where the jars are and make sure eclipse knows they've been added to the project. Specifying the file path alone is (apparently) not enough
I've faced this issue a couple of times and following the below steps has resolved both the times.
1. Navigate to C:\Users\
2. locate the ".m2" folder and delete it.
Now navigate to the particular project in eclipse and Right-click on the project > Maven > Update Project
wait until the project is updated and in my case following the above steps resolved both the times.
I was getting an additional warning
The compiler compliance specified is 1.6 but a JRE 1.8 is used
Resolving this warning make the error also go away. The steps are as follows:
I right-clicked on it, then clicked on Quick Fix. From the dialog that opened I selected Open the Compiler Compliance property page, and clicked the Finish button.
(This is same as Java Compiler section.)
In this dialog I found the Compiler compliance level drop down and changed 1.6 to 1.8, and clicked on Apply and close.
I got a message box Compiler Settings Changed which asked if I wanted to Build the project now?. I clicked on Yes.
The build path error went away.
Go to > Right CLick on your project folder > Build Path > Configure Build Path > Libraries Tab > remove project and external dependencies > apply & close
Now, Gradle refresh your project.
Added below to pom.xml file and it worked eventually:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
Goto to Project=>Build Automatically . Make sure it is ticked

eclipse debugger: attaching source-code of maven dependencies?

I'd like to use the source code of maven-managed dependencies when debugging our webapp in myEclipse 8.
I have managed to attach the sources to the libraries in the "Maven Managed Dependencies" classpath container, i.e. when I open a class file from a dependency (e.g. using Ctrl-Shift-T), I see the source code.
However, when I define a server connector for my tomcat, deploy the wepapp to it, and launch it in debug mode and execution halts on a breakpoint in that same class, the editor pane only displays the text "source not found", and a button to edit the "source lookup path". I have attempted to manually add the "Maven Managed Dependencies" classpath container, only to be told "Use maven project settings to configure depedency resolution". However, I see no useful setting in that property pane ...
How can I attach those sources? I am aware that this works with the m2e plugin and wtp, but I'd rather avoid convincing the rest of my team to switch plugins ...
Looks like issue MNGECLIPSE-983
I have confirmed that if I manually pick the External Archive option and find the relevant -sources jar (navigating that big .m2/repository tree to find it) and then add the jar as a sources it does work, and surprisingly it does remember the next time which isn't too bad.
That's at least doable I think for me because we don't often need to step debug through external dependencies, but when we do, it's often frequent, so adding it once while a bit of a pain, can be done on a case by case basis.
I have since discovered that this problem only occurs if the server is launched using a launch configuration.
The problem does not occur if the server is started by:
click the server icon in the toolbar -> context menu appears
mouse over the intended server -> submenu appears
click on "Start"
While this precludes sharing the server configuration by checking the launch configuration into version control, it at least allows seamless debugging.
Please do the following steps in Eclipse IDE(Tested with Version: 3.5.2),
In Package Explorer, Right Click on the Project which integrated with Maven container.
Select Maven 2 and then select "Fetch Source JARs".
The above action wil fetch sources of all the 3rd party jars present in the Maven Classpath.
Regards,
Rajesh.
Just put the .m2/repository/ folder itself with the search subfolders option.