Merlyn Morgan-Graham
Merlyn Morgan-Graham

Reputation: 59111

Linking libraries from JBoss 7 AS modules directory

If there is a library present in JBoss AS 7 under the /modules directory, what is the best way to go about referencing it in my project?

I'm working on a project that used to just throw each module's dependencies in a /lib folder, parallel to /src. The Ant build would simply reference those /lib folders.

I'm not above simply throwing JBoss in source control, though I don't look forward to referencing each library by their /modules sub-directory. Is there a better way?

If it provides additional avenues of solving the problem: I'm using IntelliJ IDEA, though using an Ant build rather than the default Make build, and we need our Ant build to work from the command line.

Upvotes: 2

Views: 9637

Answers (2)

Philippe Marschall
Philippe Marschall

Reputation: 4604

If you do not want to use a dependency manager (Maven, Ivy, …) you can either check them in or reference them in the JBoss installation folder. Should you decide to do this you'll probably want to have a variable pointing to the JBoss installation. You need to be able to differentiate between dependencies coming from JBoss and others. The later ones you need to package with our application, the former ones must not go into your application but need to be referenced in jboss-deployment-structure.xml (unless automatically provided by JBoss).

Personally I recommend using a dependency manager, they support dependencies that you only need for compilation and will be provided at runtime. And they also provide features for things like JUnit only being needed by the tests and not the application.

Upvotes: 1

anirudh bhatnagar
anirudh bhatnagar

Reputation: 511

JBoss AS7 has a concept of implicit modules dependency. dependencies for modules like JPA,CDI will get added automaticaly. You can check the complete list here : https://docs.jboss.org/author/display/AS7/Implicit+module+dependencies+for+deployments

Otherwise,you would need to add a Dependencies: manifest entry.

This entry consists of a comma separated list of module names that the deployment requires. The available modules can be seen under the modules directory in the application server distribution.

For example to add a dependency on javassist and apache velocity you can add a manifest entry as follows:

Dependencies: org.javassist export,org.apache.velocity export services,org.antlr

You can read more here : https://docs.jboss.org/author/display/AS7/Developer+Guide#DeveloperGuide-DeploymentModuleNames

Upvotes: 2

Related Questions