JBoss AS Maven plugin

696 Views Asked by At

I am using the jboss-as-maven-plugin from redhat. I have a standalone JBoss Server with port offset 100 and want to use a property with this value. But if I use the following configuration, the plugin uses the default port 9999

JBAS012144: Could not connect to remote://localhost:9999

 <plugin>
    <groupId>org.jboss.as.plugins</groupId>
    <artifactId>jboss-as-maven-plugin</artifactId>
    <version>7.7.Final</version>
    <configuration>
        <port>${jboss.port}</port>
    </configuration>
 </plugin>

 <properties>
    <jboss.port>10099</jboss.port>
 </properties>

I know I can start the deployment with -Djboss-as.port=10099 but i prefer the property.

1

There are 1 best solutions below

0
On

It would be really nice, to set the properties in an extra file. So I took the properties-maven-plugin to read a user.properties file with the properties jboss.host and jboss.port. This plugin is invoked by the initialized Phase

 <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>properties-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>read-properties</id>
            <phase>initialize</phase>
            <goals>
                <goal>read-project-properties</goal>
            </goals>
            <configuration>
                <files>
                    <file>${project.basedir}\user.properties</file>
                </files>
            </configuration>
        </execution>
    </executions>
 </plugin>

I can read and use the properties from the file in the whole lifecycle, but when I call jboss-as:deploy, the properties are empty and the Plugin took the default values. The JBoss Plugin sais: Invokes the execution of the lifecycle phase package prior to executing itself.