Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6719693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:07:23+00:00 2026-05-26T09:07:23+00:00

I need to generate module.xml file for JBoss7 for a maven project which has

  • 0

I need to generate module.xml file for JBoss7 for a maven project which has a lot of jar-dependencies. What is the easiest way to do it? The file looks like:

<module xmlns="urn:jboss:module:1.0" name="ats.platform">
  <resources>
    <resource-root path="dom4j-1.6.1.jar"/>
    <resource-root path="jdom-1.0.jar"/>
...
  </resources>
</module>

so that the <resource-root> element should be created for each project jar-dependency.

Or maybe I doing something wrong? What’s correct way to create a JBoss7 module from a maven project?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:07:23+00:00Added an answer on May 26, 2026 at 9:07 am

    I don’t really know about JBoss and whether there’s another way to do this, but you can do it quite simply with GMaven:

    <plugin>
        <groupId>org.codehaus.gmaven</groupId>
        <artifactId>gmaven-plugin</artifactId>
        <version>1.3</version>
        <configuration>
            <source>
                def sw = new StringWriter()
                def xml = new groovy.xml.MarkupBuilder(sw)
                xml.module(xmlns:'urn:jboss:module:1.0', name:'ats.platform') {
                  resources {
                    project.runtimeClasspathElements.each {
                      def path = it.find(".*?([\\w\\.-]*\\.jar)") { it[1] }
                      !path?:'resource-root'(path:path)
                    }
                  }
                }
                println sw
            </source>
        </configuration>
    </plugin>
    

    A couple of things to note:

    1. That script spits the XML out to stdout, but you can obviously write it to a file or whatever very easily.
    2. The runtimeClasspathElements contain absolute paths to the jar, which is why I parse it with a regex. You can adjust the regex to include more of the path or just prepend a string if you need more than just the jar file name.

    I’ve posted a working example on github (it’s just a POM) where I’ve bound the above plugin configuration to the initialize build phase. If you have git, you can clone and run it yourself with:

    git clone git://github.com/zzantozz/testbed tmp
    cd tmp
    mvn -q initialize -pl stackoverflow/7755255-gmaven-to-build-xml-from-classpath
    

    In the sample project, I added jdom 1.0 and dom4j 1.6.1 as dependencies, and here’s the output it created:

    <module xmlns='urn:jboss:module:1.0' name='ats.platform'>
      <resources>
        <resource-root path='jdom-1.0.jar' />
        <resource-root path='dom4j-1.6.1.jar' />
        <resource-root path='xml-apis-1.0.b2.jar' />
        <resource-root path='aspectjrt-1.6.11.jar' />
      </resources>
    </module>
    

    Note: I’m not a groovy expert, so there may be a groovier way to do it, but you can see how easy it is even so.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a main pom.xml which has multiple modules. These modules need to generate
I need to generate an XML file in C#. I want to write the
We need to generate LINQ queries which are 100% unknown during coding (design time).
I am creating an XML file using the System.Xml.Serialization module. I have a class
My project has a reporting module that gathers data from the database in the
I have a Java multi-module Maven project that I want to build an MVN
I just need a tool to generate this file. I've seen there is a
Drupal modules are php files with .module file extensions. To generate tags on these
I have a long list of domain names which I need to generate some
In a django project, I need to generate some pdf files for objects in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.