3

When selecting a new maven project from the Netbeans New Project Menu, there is the option to create a Web Application, or a Standalone Application. I'd like to create a Class Library for use with a Web Application.

How would you recommend I go about this. I see the new Servlet 3.0 Web Fragments need to be put into the META-INF folder and saved as web-fragment.xml. I'm not too sure where I'd create this directory if I'm packing a JAR and a WAR.

Some insight would be greatly appreciated.

sparkyspider
  • 13,195
  • 10
  • 89
  • 133

2 Answers2

9

You can create either Java application or Web Application. Just place the META-INF folder in the src/main/resources folder. and place web-fragment.xml directly under it. You can also place any images,css or javascript files in META-INF/resources folder. So when the application you are deploying this for will look in the WEB-INF/lib folder and load all the META-INF contents of the jar onto the classpath.

Ravi Kadaboina
  • 8,494
  • 3
  • 30
  • 42
1

when generating the .war file with standard maven settings (no special config of maven-plugin-war) the web-fragment.xml should found in the /META-INF dir of the generated JAR file inside the WAR's /WEB-INF/lib dir.

in our case the web-fragment.xml was not in this dir but in the WAR's /META-INF dir, which is the wrong place

electrobabe
  • 1,549
  • 18
  • 17