11

How can I make Jenkins deploy my project to JBoss EAP(AS7)?

I see that Jenkins can deploy a project to JBoss 5.x if it builds ok but how can I make it deploy to AS7 or EAP if it builds ok? Can someone please tell me if this can be done.

techsjs2012
  • 1,737
  • 5
  • 25
  • 57

2 Answers2

13

You can use the official JBoss Application Server Maven Plugin.

Attach it to the install phase and configure Jenkins to execute mvn clean install. If you don't feel comfortable attaching the execution, you can call it directly:
mvn jboss-as:deploy

Here is an example of a build setup:

    <plugin>
        <groupId>org.jboss.as.plugins</groupId>
        <artifactId>jboss-as-maven-plugin</artifactId>
        <version>7.1.1.Final</version>
        <configuration>
            <hostname>${deploy.jboss.host}</hostname>
            <port>${deploy.jboss.port}</port>
            <username>${deploy.jboss.user}</username>
            <password>${deploy.jboss.password}</password>
            <name>${backend.deployment-name}</name>
            <filename>${project.build.finalName}.war</filename>
            <skip>${skipDeployment}</skip>
        </configuration>
        <executions>
            <execution>
                <id>deploy-jar</id>
                <phase>install</phase>
                <goals>
                    <goal>deploy</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</plugins>
</build>

EDIT Jenkins config - after you create a maven project, there is a setting for what goals to execute. Search for the Build config, and there, for the input labeled goals and options - enter the goals into this input.

Configuring the Jboss AS plugin - see the <configuration> part in the pom snippet above - you can set the <hostname> to 127.0.0.1 to test locally.

messivanio
  • 2,263
  • 18
  • 24
kostja
  • 60,521
  • 48
  • 179
  • 224
  • this looks good but how do I tell Jenkins to run a mvn install – techsjs2012 Jan 17 '13 at 17:28
  • also if I do this jboss-as:deploy does not go to my local AS7 server for testing anymore.. Both commands will goto the remote server – techsjs2012 Jan 17 '13 at 17:42
  • @techsjs2012 - have added some more config details, hope it helps - see my edit. Also please see the official jenkins and joboss-as plugin docs. They are good :) – kostja Jan 18 '13 at 12:01
  • Kostha this is over my head, can you please help – techsjs2012 Jan 18 '13 at 14:03
  • @techsjs2012 - I am not sure about th issue - It might be too much for the comments. I have created a chatroom named q14381345. Perhaps we can sort things out. – kostja Jan 18 '13 at 14:13
  • @techsjs2012 - go to the chat option on the top menu bar, on the right side of your name, search for q14381345 and join – kostja Jan 18 '13 at 14:15
0

How do you currently deploy your application to jboss? If you're using a script, you could have jenkins call the script.

Slartibartfast
  • 1,605
  • 2
  • 16
  • 23
  • we been doing it by hand :( – techsjs2012 Jan 17 '13 at 14:47
  • 1
    What do you mean by hand? Like through the web console? Or via the command line? If it's via the command line just put those commands in a script. Otherwise, your first step isn't with jenkins, it's getting your deploy to complete from the command line so that you can call it from jenkins. – Slartibartfast Jan 17 '13 at 15:04