Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I keep Eclipse Java facet?

Tags:

java

eclipse

As stated in the documentation about facets in general:

Project facets in Eclipse define characteristics and requirements for Java EE projects and are used as part of the runtime configuration

And the Java facet itselt in the project settings shows a description:

Adds support for writing applications using Java programming language.

All this is very general information and I cannot imagine what this facet can do for me. There are already at least two projet settings regarding java:

  • Java build path / Libraries / JRE System Library which is the default runtime, when I execute a class (test or main) from that project.
  • Java compiler which specifies (source and target) java compliance version and can optionally reference version of java from build path above.

As I see, the only result of java facet are version mismatch errors, if I set incorrect version.

I am using STS-3.6.3 and the projects are simple maven jar projects that are referenced by a maven war project. I run and debug the war project inside Tomcat from eclipse, so some of the code changes are hot redeployed (I thing, facets have no impact on this).

So, why should I keep the java facet instead of simply turning it off?

like image 403
vnov Avatar asked Jul 07 '26 09:07

vnov


1 Answers

Facets automate some parts of project configuration and deployment.
For example inform you when servlet is not added to web.xml in dynamic web project. Stuff like that.
When you add JPA facet, eclipse will create persistence.xml and will keep notifying when you create entity class but don't configure it in persistence file.
There's lots more, adding facets to projects also reconfigures how your project structure looks in eclipse.

Basically they do exactly as you quoted: "

Adds support for writing applications using Java programming language.

Every facet add something new so if you want more specific answer you have to answer question about specific facet. If you don't know what they can do for you - turn them off. You can always add them when you learn more.

Real life example:
Adding JPA facet messed up my project using ObjectDB by creating persistence file, which, turned out, I didn't even need.

like image 183
zubergu Avatar answered Jul 09 '26 23:07

zubergu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!