Loose classpath web libraries support

The workbench now provide loose classpath web libraries support for your web projects.

About this task

Loose classpath support is an optional mechanism that allows for the inclusion of Eclipse Java™ development tools classpath artifacts in a web project's WEB-INF/lib folder. You can add dependences using the Deployment Assembly page, but you can also add the web libraries from the Libraries page under the Java Build Page. You can include JAR files, external JAR files, libraries, and variables. The project validator now detects loose classpath issues and reports them in the problems view.

Procedure

  1. Right-click your web project and select Properties > Java Build Path > Libraries.
  2. Select Add Jars, and select the jars that you want to add to your web project. Click Okay.
    Add Jars to Java build path
  3. Because these JAR files are added only to the build path and are linked as components, if you deploy this EAR/WAR or export this EAR/WAR none of these JAR files are included. A warning message appears in the Problems view: Classpath entry /AddJars/AddJars1.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.
    Classpath warning.
  4. Right-click the warning message and select Quick Fix. You can either:
    • Mark the associated raw classpath entry as a publish/export dependency.
    • Exclude the associated raw classpath entry from the set of potential publish/export dependencies.
    Quick Fix options
  5. If you look at the .classpath file, the JAR files are now either included or excluded from the dependencies:
  6. Right-click web project, and selectProperties > Deployment Assembly to see what jars are included as a web library dependency:
    Java EE Module Dependencies
    Also, you can add JAR files as a web library dependency by clicking Add:
    Add Java Build Path Entries

Feedback