• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What does Project>Clean do in Eclipse?

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does Project>Clean do in Eclipse? Sometimes I have to do this to remove the compile time errors from the screen and other times I have to do this to get my code running without runtime errors. I'm still not sure exactly what this does though. Any help is appreciated.

Thanks.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It removes the .class files and recompiles the project. Basically, it forces a rebuild.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:It removes the .class files and recompiles the project. Basically, it forces a rebuild.



Almost. It removes the products, but the rebuild part is only automatic if you have automatic build turned on. Which is the default, but on occasion I have had to turn it off.
 
Ajay Dhar
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the replies. This is a basic question but what does it mean to build the project?
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ajay Dhar wrote:Thanks for the replies. This is a basic question but what does it mean to build the project?


For a Java project, it means compiling all Java classes.

From the documentation:


Java builder

The Java builder builds Java programs using a compiler that implements the Java Language Specification. The Java builder can build programs incrementally as individual Java files are saved.

Problems detected by the compiler are classified as either warnings or errors. The existence of a warning does not affect the execution of the program; the code executes as if it were written correctly. Compile-time errors (as specified by the Java Language Specification) are always reported as errors by the Java compiler. For some other types of problems you can, however, specify if you want the Java compiler to report them as warnings, errors or to ignore them. To change the default settings, use the Goto the Java compiler preference page Java > Compiler > Errors/Warnings preference page.

The Java compiler can create CLASS files even in presence of compilation errors. However, in the case of serious errors (for example, references to inconsistent binaries, most likely related to an invalid build path), the Java builder does not produce any CLASS files.

 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To amplify on this a bit: If you look at your Project Properties dialog, you'll see a topic named "Builders". This is where the Builders for the project are managed. In a Java project, that will include the Java Builder. I have projects that also include a Maven Builder. In fact, you can design and incorporate custom builders into Eclipse as plug-ins, but that's more work than most of us want to do.

The builders are responsible for ensuring that whatever resources they manage are properly built. The Java builder watches over Java source folders and ensures that classes are recompiled as needed.

As I said earlier, building is normally automatic, although you can switch to manual operation of the builders if the situation requires it.

Builders handle the everyday low-level aspects of working with a project and its products, but they're not intended to do everything. Which is why Eclipse also supports specialized builds using Maven and Ant.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would help to know what Project->Clean actually does. Does it call 'mvn clean'?

Also, what does the build step do? Does it call 'mvn compile'?

The reason I am asking is I noticed that the build automatically will not filter my properties file. If I do 'mvn compile' the MAVEN_VERSION=${project.version} from the properties file in src/main/resources is copied to the target/class directory with the ${project.version} flag appropriately substituted. However, from Project->Clean, this does not happen.
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, Eclipse project clean doesn't run Maven. A Maven Clean is different.

Mostly Eclipse Clean is good for when Eclipse gets a scrambled idea of the state of the project.
 
reply
    Bookmark Topic Watch Topic
  • New Topic