0

I have set up a Maven project that starts up a standalone Wildfly container using Cargo, but in the process of adding some new features, I need to add some content to the standalone.xml. (Specifically, a security realm.) This seems like it should be a fairly common task, but I can't find a way to do it.

I tried to use the xml-replacement feature built in to cargo, but it doesn't seem to be capable of adding content, only modifying existing content. My second attempt was to use the maven-replacer-plugin, which feels like a hack, but would have done the job. The problem I have with it is that I can't find a way to execute the replacer plugin between when cargo installs the container, and when cargo starts the container.

Thanks in Advance

Alex N.
  • 654
  • 8
  • 21

2 Answers2

0

I'd recommend switching from Cargo to the wildfly-maven-plugin, which is container-specific but more straightforward to use.

You can run any CLI command via the plugin to edit your standalone.xml.

See this example from one of my projects.

Harald Wellmann
  • 12,615
  • 4
  • 41
  • 63
  • Unfortunately this POM is quite mature, and I'm not sure I want to try to port all of its accumulated configuration to another plugin. And beyond that, a CLI command is uncomfortably close to platform dependence, and that's a hard line for this project. – Alex N. Feb 27 '15 at 20:44
  • 1
    Server configuration will always be platform dependent. If you're trying to update raw XML using CLI would be much safer. – James R. Perkins Feb 28 '15 at 23:03
  • @JamesR.Perkins SO didn't notify me that you replied, and I didn't notice. Sorry about the delay. I wholeheartedly disagree with this. Right now my project successfully builds, deploys, and runs on Windows, Mac, and Linux with no problems. What is it that you think actually has to be platform dependent? – Alex N. Mar 03 '15 at 21:21
  • Sorry by platform I really meant server :) GlassFish doesn't have the some configuration details as WildFly is all I meant. So using a plugin made for the platform seems to make more sense IMO. – James R. Perkins Mar 04 '15 at 18:51
  • Ah. I that makes more sense. Agreed, except cargo does have container specific configuration, they're just missing the ones I need. Isn't that always the way it goes. Wildfly configs: http://cargo.codehaus.org/WildFly+8.x Glassfish configs: http://cargo.codehaus.org/Glassfish+4.x – Alex N. Mar 04 '15 at 19:11
0

Of course you can override the container's configuration, see here and there how you can do that.

In your case if you wanted to put a custom standalone.xml, you simply have to embed the entire file in your project and put it in the configFiles for cargo to deploy it with your container.

Fabien
  • 859
  • 6
  • 15
  • The problem with completely overriding the standalone xml, is that when the container package updates, you have to manually merge the changes into your copy of the standalone. – Alex N. May 26 '15 at 14:32
  • Yes that's the disadvantage of this method. In the project in which I did that we considered that we would not change the version of our application server often enough (because of the stabilization phases) and so we though that it was a small inconvenience. – Fabien May 26 '15 at 18:24