One-click remote deployment with jboss and eclipse via maven

Create a maven goal which deploy to a remote jboss eap 6.x instance is quite simple.

Just add the following to your pom.xml

    <plugins>
			<plugin>
				<groupId>org.jboss.as.plugins
				<artifactId>jboss-as-maven-plugin
				<version>7.6.Final
				<configuration>
					<username>admin
					<password>Admin#1234
					<hostname>192.168.0.10
					<port>19999
				</configuration>
			</plugin>
      </plugins>


Then create a maven run configuration in eclipse having:
– Base directory set to the variable ${project_path} (so that it applies to the current project)
– Goal: jboss-as:deploy

Managing dependencies with maven

Maven is a nice build tool helper for java projects. A cool feature is the way to specify if some dependencies are

  1. necessaries at runtime
  2. provided by the application server
  3. necessaries while doing tests but not at deploy time

That’s an example in my pom.xml:

<!– I need to embed javamail in my package –>

<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>

<!– while Log4j is provided by the application server –>

<dependency>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
<version>1.2.14</version>
<scope>provided</scope>
</dependency>
<!– and  Hypersonic Database is used for testing–>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.1</version>
<scope>test</scope>
</dependency>