[jboss-user] [JBoss Tools] - Add jboss-deployment-structure.xml dependencies to Eclipse build path.

Bron Eubanks do-not-reply at jboss.com
Mon Jul 30 11:51:48 EDT 2012


Bron Eubanks [https://community.jboss.org/people/beubanks] created the discussion

"Add jboss-deployment-structure.xml dependencies to Eclipse build path."

To view the discussion, visit: https://community.jboss.org/message/751024#751024

--------------------------------------------------------------
Background: I am deploying a dynamic web project to JBoss AS 7.1.1 using Eclipse 4.2 with JBoss Tools 3.3.0 Final. My project's build path includes the JRE System Library, JBoss 7.1 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);


The JBoss runtime that the project is using is configured correctly. It points to a valid JBoss directory, and the module dependencies are properly installed in the server.

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:
1. 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.
2. Add the libraries to WEB-INF/lib. This is not acceptable because it defeats the purpose of server modules.
3. 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.

Have I missed a solution to this problem that JBoss Tools already provides? Or, does anyone have any other ideas?

Thanks in advance,
Bron
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/751024#751024]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120730/fbaaee41/attachment-0001.html 


More information about the jboss-user mailing list