Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-18377

Automatically add the dependencies specified in jboss-deployment-structure.xml to build path

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 4.3.0.Beta1
    • None
    • server
    • None

      I am deploying a dynamic web project to EAP 6 using JBDS 6+. My project's build path includes the JRE System Library, EAP 6 Runtime, and Web App Libraries (the WEB-INF/lib folder). I also have a jboss-deployment-structure.xml file that defines additional module dependencies such as the following:

      <jboss-deployment-structure>
      <deployment>
      <dependencies>
      <module name="org.slf4j" />
      <module name="org.apache.log4j" />
      </dependencies>
      </deployment>
      </jboss-deployment-structure>

      The problem is, the slf4j and log4j modules are not included in the project's build path. While the server resolves them correctly at runtime because of the jboss-deployment-structure.xml file, Eclipse doesn't include them. So the following declaration in the Java code would result in a build error because org.apache.log4j cannot be resolved to a type:
      private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(Example.class);

      Please note that the project has configured correctly the JBoss Server Runtime which points to a valid JBoss directory, and the module dependencies are properly installed in the server.
      The dependencies specified in the jboss-deployment-structure.xml are some private modules installed at the server side but not included in the server runtime by default.
      So, is there a way to automatically add the jboss-deployment-structure module dependencies to the Eclipse build path? So far, I've been unable to find a way to do this.
      I have found a few workarounds, but none of them are ideal, and they seem to completely miss the point of module-based dependencies:

      • Customize the Default Classpath Entries for the server runtime. This is not acceptable because it must be done in each developer's workspace – and possibly per project since projects may have different, conflicting dependencies.
      • Add the libraries to WEB-INF/lib. This is not acceptable because it defeats the purpose of server modules.
      • Add the libraries to a user library for the project. This could work, but it's very inconvenient, because each developer on the team would have to add the jars to the user libraries in their workspaces.
        Here can find the discussion of exact same issue https://developer.jboss.org/thread/203309?tstart=0

              rob.stryker Rob Stryker (Inactive)
              rhn-support-ghu Gary Hu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: