I have a Java EE 7 project which is deployed to WildFly 8.1.0-Final. I use a standalone Wildfly server managed by Maven (i.e., clean configuration on every mvn clean
) for testing, and the "normal" server remotely.
In order to deploy to both servers with the maven-wildfly-plugin (1.0.2.Final), I have configured two Maven profiles: wildfly-local, which defines local username, password, and port number; and wildfly-remote, which defines remote username, password, and port number.
However, the remote server runs in domain mode, while the local server does not. Thus, I am required to define a domain configuration with a server-group for the remote server, like so:
...
<plugin>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<hostname>${wildfly-hostname}</hostname>
<username>${wildfly-username}</username>
<password>${wildfly-password}</password>
<domain>
<server-groups>
<server-group>${wildfly-server-group}</server-group>
</server-groups>
</domain>
</configuration>
...
</plugin>
...
${wildfly-hostname}
and the three other proiperties are defined in the profile, and this configuration works. However, the standalone, non-"domain mode" local test server does not allow deployment of an application where a server-group is defined at all.
My first thought was to define a nested property in the remote profile, like so:
<profile>
<id>wildfly-remote</id>
<properties>
...
<wildfly-domain>
<server-groups>
<server-group>*my server group name*</server-group>
</server-groups>
</wildfly-domain>
...
</properties>
</profile>
... and a simple property in the local profile, like so:
<profile>
<id>wildfly-local</id>
<properties>
<wildfly-domain/>
</properties>
</profile>
Maven does not like this because it cannot parse tags where text is expected.
Is there any way of defining a "resource" which is nested in one Maven profile, but flat in another?
Properties are just simple key-value pairs, the value can't be parsed as markup.
Move the entire configuration into the profile instead.