views:

308

answers:

2

I wonder not only what is Facet but also what is Facet 'in physical level' (as I understand it's not a separate jar, but what?)?

I also wonder how can it affect my application after deploying. I'll explain on real example:

I had 2 facets (which were created by IDE): Spring Facet and Web Facet (for jsf). I deployed it to Tomcat and my application worked fine.

Then I added (by means of IDE) one more facet - JPA Facet. I redeployed application and.. it still worked fine :)

So, I'm just curious what is that and why do we need it?

+3  A: 

This is not Java EE related. This is IDE related. The term is at its own not programming related.

From http://www.thefreedictionary.com/facet

fac·et (fst) n.

  1. One of the flat polished surfaces cut on a gemstone or occurring naturally on a crystal.
  2. Anatomy A small, smooth, flat surface, as on a bone or tooth.
  3. Biology One of the lenslike visual units of a compound eye, as of an insect.
  4. One of numerous aspects, as of a subject. See Synonyms at phase.

It's 4.

In this specific case it's just an aspect which is to be used in the project, so that the IDE can intercept on it with regard to generators, wizards, auto-include libraries and so on. If you add for example the JPA facet, then you will get more options to do the IDE-magic with JPA.

BalusC
hm.. I use IDEA. Are there any facets in Eclipse or NetBeans?
Roman
Eclipse has them as well. I don't do Netbeans.
BalusC
answer should be simple and easy to understand by anyone.
Venkat
So you are not "anyone"? Sorry, can't help that.
BalusC
+3  A: 

As BalusC said, this is not JEE related but IDE related. This allows to add "characteristics" to a project in a flexible way.

From the IntelliJ IDEA Q&A for Eclipse Users (because you mentioned IDEA):

Q: Facets — what they are for?

A: To streamline the project configuration.

Facets encapsulate the support for a variety of frameworks, technologies and languages. For example, to enable Spring in your project, you only have to add the corresponding facet. All libraries are downloaded and configured, you get the full range of coding assistance, refactorings, etc. Moreover, the code model is also recognized, so you are completely free from worrying about any configuration issues.

In most cases, you can add more than one facet of the same type to your project. For example, you can have multiple Web facets for deploying the application to different servers, or several EJB facets, each for its own EJB version. (See also Project Configuration.)

And yes, Eclipse uses "Facets" too:

alt text

AFAIK, NetBeans doesn't (see Q: How do I configure a web framework for my project?).

Pascal Thivent