I'm using Eclipse IDE (4.2). When I make a change in Eclipse and try to debug it, the previous version is compiled, but not the new one. To get around this, I do maven clean/build and then refresh the project. But this is very tedious and I need to do it every time I make any changes. Is there another way around this or a plugin that I can use to pick up these changes automatically?
Asked
Active
Viewed 1.1k times
5
-
1Is `Project -> Build Automatically` ticked? And did you save the relevant file before debugging? – Absurd-Mind Apr 30 '14 at 13:20
-
Hi, the project is saved. Im new to Eclipse, is there a tickbox to trigger the build automatically when i save it? Or do i need to go Project >> Build Automatically – user648244 Apr 30 '14 at 13:33
-
When you click Project in the title bar you should see a tick left of `Build Automatically`, if not click it one time. – Absurd-Mind Apr 30 '14 at 13:35
-
that still does not work, seems like i still have to clean/install with maven .. – user648244 Apr 30 '14 at 14:00
-
That's odd. What Kind of Project is it? Are there any error (in `Problems` section)? Can you provide a screenshot of your eclipse? – Absurd-Mind Apr 30 '14 at 14:04
-
Just a basic java application. It seems that eclipse packages the module as a jar and then during debug/compilation runs the code from jar. Is there a way to avoid this? or an automated process? similar to Intellj – user648244 Apr 30 '14 at 14:22
-
No, it doesn't. It builds all classes to `target/` directory and runs them from there. Is your project a dependency used by a different project? – Absurd-Mind Apr 30 '14 at 14:28
-
@user648244 how it worked for you? – akash patel Oct 27 '20 at 13:27
3 Answers
5
Click Project > Build Automatically
once and make sure that tick mark is appeared in front of Build Automatically
option.
Also you have to enable hot code replace options. Click Windows > Preferences
. Go to Java > Debug
select all options in Hot Code Replace group

Chandrayya G K
- 8,719
- 5
- 40
- 68
-
1Its still Not working, I have tried the same operation in Eclipse Neon and Mars2 . Its picking the old complied jars from the target. Not not will automatically at all. Its annoying to clean and build jars again and again even making a small changes. Will look for more suggestion pls. – user216112 Apr 21 '17 at 06:28
2
I had the same problem and these steps fixed it:
- Run -> Run configurations
- Select the one giving the problem
- Go to the Source tab
- Make sure your project is the first entry there
- Mine had just the Default set there so I had to do this: Add -> Java Project -> Select your Project and add it

pmk
- 21
- 2
0
I had the same problem, the reason was a wrong configuration of the javabuilder in the .project managed by Eclipse. I opened it and rewrote the buildspec
section so that either Maven or jdt.core can compile. Once done, relaunch Eclipse and if the Project > Build Automatically option is enabled, any change should now be reflected:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ProjectName</name>
<comment>My beautiful project</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>