I'm going through the tutorial (https://docs.oracle.com/javaee/7/firstcup/creating-example002.htm). I have Eclipse for EE developers (4.6.3) with Glassfish (4.x) properly configured in it.
I see the project folder under glassfish4\docs\firstcup but I don't know how to import it since the instructions are for Netbeans. If I try to "Open projects from file system" or a general import I get just the folder structure in the workspace and not with the right "flavor":
Then Glassfish doesn't recognize this as a resource that can be added. How do I do this in Eclipse?
I was stuck with the same problem.
Here are the steps I took to make it work.
firstcup project and build.dukes-age project and the firstcup-war project, go to File > New > Maven Project.glassfish in Filter and you will see the 2 archetypes you need for the tutorial.

dukes-age project, type firstcup.dukesage.resource in Group Id and dukes-age for Artifact Id. Click Finish.-SNAPSHOT from the line <version>8.0-SNAPSHOT</version>. Save.http://localhost:8080/dukes-age/webapi/dukesAge/.Note for the firstcup-war project. Before adding the project to the server, make sure you start Derby by running ./asadmin start-database inside glassfish5/bin. Otherwise, you have to remove the project from the server and add it back.
That's all. Other than that, everything is quite similar to the steps in the tutorial. Feel free to ask.