2

Not sure there's a way to do what I want with jboss-cli, so looking for confirmation.

If I connect to EAP using jboss-cli and run this command to add a module:

[standalone@localhost:9999 /] module add --name="test" --resources="."
Failed to locate C:\EAP-6.4.0\bin\"."

The module add command should create a module.xml with the following element:

<module xmlns="urn:jboss:module:1.1" name="test">

    <resources>
        <resource-root path="."/>
    </resources>

<dependencies>

According to module add --help, it looks like the command expects a physical resource to copy into the directory where module.xml is created:

 --resources     - (used with add, required unless module-xml is used) a list of
               filesystem paths (usually jar files) separated by a
               filesystem-specific path separator, i.e.
               java.io.File.pathSeparatorChar. The file(s) specified will be
               copied to the created module's directory.

The description seems to match the behaviour, so just looking for confirmation that there isn't a "jboss-cli" way, before resorting to sed.

Thanks.

Robin Coe
  • 750
  • 7
  • 28
  • 1
    It doesn't look like that is possible to do with CLI. You can file a request for enhancement here if you'd like https://issues.jboss.org/browse/WFCORE. – James R. Perkins Oct 11 '17 at 19:58

1 Answers1

1

On JBoss EAP 7.2 (and likely on other versions of JBoss too), it is possible to do this by creating the module.xml file in advance and using "module add" with the --module-xml option to explicitly specify the module.xml file.

Here is an example which creates a module consisting of a single properties file, creates the module.xml file, and then adds the module to JBoss:

% mkdir /tmp/module-src
% cd /tmp/module-src
% echo hello=bonjour > example.properties
% cat > module.xml
<module xmlns="urn:jboss:module:1.1" name="test">
  <resources>
    <resource-root path="."/>
  </resources>
<dependencies>

% jboss-cli.sh --command="module add --resources=example.properties --module-xml=module.xml --name=test"

This creates the module directory, copies the module file (with resource-root path=".") into the module directory, and copies the specified resource(s) into the module directory.

J. Beattie
  • 183
  • 1
  • 7