28

I'm trying to run Wildfly 8.0 from Intellij IDEA. When starting WildFly through commmand-line I can use the -c standalone-full.xml parameter to use the standalone-full.xml configuration file. How can I specify this when running WildFly from Intellij IDEA?

Vy Do
  • 46,709
  • 59
  • 215
  • 313
jorgen.ringen
  • 1,285
  • 5
  • 14
  • 20

8 Answers8

56

In my opinion switch -c standalone-full.xml is not a VM Option so I will post a little bit different solution: In the Run/Debug configuration for your server in the tab Startup/Connection you have the ability to set Startup script: On the end of line there is checkbox Use default. Please unselect it and paste on the end of the input -c standalone-full.xml

Krzysztof Miksa
  • 1,519
  • 1
  • 16
  • 23
  • 1
    Thank you, this is the correct answer. As mentioned, this is not VM Options. – jorgen.ringen Sep 17 '14 at 08:06
  • 1
    Important: it seems that IntelliJ always reads ports from standalone.xml, so if you ports differ, you will be unable to deploy. – Željko Trogrlić Sep 23 '16 at 13:12
  • 1
    The answer from @MikeHoldsworth has the advantage that can you specify your standalone configuration once in the `VM options:`. When using the `Startup script:`, you have to do it three times: for `Run`, `Debug` and `Coverage`. – pesche Apr 04 '18 at 14:43
  • This doesnt work on intellij 2017.1.3 and wildfly 10 – Dinesh Jun 17 '18 at 00:56
  • 1
    @Krzysztof Miksa Thanks a ton.. saved my day – Gandhi Jun 13 '19 at 05:37
39

Adding -Djboss.server.default.config=standalone-full.xml to VM_OPTIONS is the equivalent of running standalone -c standalone-full.xml from a shell

Mike Holdsworth
  • 1,088
  • 11
  • 12
9

As said by Mike Holdsworth -Djboss.server.default.config=standalone-full.xml works perfectly. But there is another advantage over the -c standalone-full.xml method.

When you rename your standalone.xml file to create custom configuration files for multiple environments. Like env1.xml, env2.xml, etc. If you use -c env1.xml, Intellij will give you the following message:

Error: HTTP management port configuration not found.

So you have to put a basic standalone.xml who will be overriden at the startup by the one you give with the -c option.

The -Djboss.server.default.config=env1.xml will prevent it.

Nicolas Dupouy
  • 450
  • 1
  • 7
  • 11
  • 1
    Brilliant. I used to have complete different 'standalone' directories for each config but adjusting my scripts to point to the currently correct dir was annoying. With your method I just have one dir with multiple configs! – ifloop Oct 05 '18 at 07:57
  • Great addition. Instead of creating a new answer, it would be nice to append this to the either @mike-holdsworth 's answer, or to the accepted one. – Renato Back Jan 21 '21 at 13:03
  • I tried this method but it led to another problem: adding things to VM_OPTIONS will set the JAVA_OPTS and if the JAVA_OPTS is not empty, then the standalone.conf is totally skipped (and I get OOMEs because no memory allocation settings are added)... is there a simple way (= without changing to much files) to use an alternate config file AND have the standalone.conf correctly processed? – Xavier Dury Dec 10 '21 at 10:25
2

Look out for different startup scripts for "Run" and "Debug" in Intellij IDEA. If you don't uncheck "Use default" in both of them then you can end up with two different profiles on "Run" and "Debug". It is easy to forget and annoying to figure it out.

2

If you want to run it by default w/o passing any command line parameters than go to standalone.(bat|sh)

Append to the SERVER_OPTS variable: --server-config=standalone-full.xml

At least now you'll run it in full mode from any place (ide, service, command line)

andrew.dman
  • 191
  • 1
  • 5
1

I'm on a cross-platform team and we share our run configs. Modifying the startup script could cause problems (other teammate's paths and startup scripts are different), so my solution was:

  • Made a backup of standalone.xml
  • Renamed standalone-full.xml to standalone.xml

This doesn't answer the OP's question directly, but may be helpful for folks.

Jon Onstott
  • 13,499
  • 16
  • 80
  • 133
0

In the Run/Debug configuration for your server you have the ability to set VM options. You can put your switch in there. You may have problems however with jboss identifying the correct path for the file, so you may have to play with that a little bit before it works for you.

Software Engineer
  • 15,457
  • 7
  • 74
  • 102
-2
Run -> Edit configurations -> Click '+' in the top left corner -> JBoss Server -> Local

There you can configure your JBoss instance and set VM options and so on.

Olli Puljula
  • 2,471
  • 1
  • 14
  • 8