toomuchcs
toomuchcs

Reputation: 1364

Eclipse and Facets

In the courses java, everyone (or at least most people) seemed to have a working eclipse. They always seemed to have a working faces-config (a visual one), and autocomplete in xhtml files (for facelets). Though for autocomplete, we added *.xhtml files on JSP's.

It seems that this was a part I don't know well about eclipse, and it's fairly annoying since I don't know why. When I import a project (either Maven or existing), it always has no facets but java (and that in 1.5 not even 1.6), while it is supposed to be a webproject and have facelets & dynamic web project.

Can I change those facets? It seems to just work when I put java to 1.6, but trying to edit the dynamic web module version from 2.4 to 2.5 (it is standard on 2.4) without running into some troubles. Even after I just made a fresh maven project (with an archtype in commandline), I'm not able to change much about these facets.

What am I doing wrong?

Upvotes: 9

Views: 47076

Answers (4)

Curufin
Curufin

Reputation: 21

I recently upgraded an old project to Java8/Eclipse 4.6.1, and also ran into a facet version issue. In order to get the menu mentioned by @fmucar (which was not available in the Eclipse for RCP and RAP Developers package I had installed), I had to do Install New Software from the Help Menu , and select to add Faceted Project Framework. I was then able to pick the facet version from the IDE.

Upvotes: 1

fmucar
fmucar

Reputation: 14558

for eclipse

Right click on the project and choose properties from the appearing menu

There is a list in the left side of the opening window. Select project facets and you will see all available facets you can choose and adjust their settings.

Upvotes: 4

Konstantin Komissarchik
Konstantin Komissarchik

Reputation: 29139

Eclipse functionality is driven by project metadata. If you don't have the right metadata, the projects aren't going to behave correctly.

If you are starting from scratch and creating projects in Eclipse, make sure to place all of the metadata files in your source control system (including everything under [project]/.settings directory).

If you are using Maven to generate your Eclipse project metadata, make sure that you find the Maven plugin that knows about WTP. I don't have a reference, but I know it exists. This will ensure that when Maven generates metadata, it will have the correct metadata for web projects.

Can I change those facets? It seems to just work when I put java to 1.6, but trying to edit the dynamic web module version from 2.4 to 2.5 (it is standard on 2.4) without running into some troubles.

The way facet works is that the facet author can choose not to implement version change logic. Unfortunately the Java EE module facets (such as the dynamic web module) do not have version change implemented. Other facets like Java do support this. So your experience will vary from facet to facet.

If all else fails, you can edit .settings/org.eclipse.wst.common.project.facet.core.xml file by hand. Make sure to do that from Eclipse or you will need to refresh the project afterwards. Just keep in mind that if you are forcing the change like that, you might need to do some manual fixes to your project content. For instance, if you change web spec level, you may need to update the deployment descriptors.

Upvotes: 13

Gursel Koca
Gursel Koca

Reputation: 21300

You can change project facets. You should close eclipse , then goto .settings directory, org.eclipse.wst.common.project.facet.core.xml file holds all facets related info. You can add or remove a project facet .

Upvotes: 5

Related Questions