2

I want to deploy my web app from GitHub with Travis CI to my WildFly application server on OpenShift.

I followed the How to Build and Deploy OpenShift Java Projects using Travis CI tutorial but my index.html page from my Java EE 7 web app does not show up. Instead of the index.html page I get OpenShift's default page, saying: "Welcome to your WildFly 8 application on OpenShift".

What do I have to do so that my webapp is displayed?

Here are the last lines of my Travis CI console log:

remote: [WARNING] The requested profile "openshift" could not be activated because it does not exist.
remote: Preparing build for deployment
remote: Deployment id is 20db7c5e
remote: Activating deployment
remote: HAProxy already running
remote: HAProxy instance is started
remote: Deploying WildFly
remote: ls: cannot access /var/lib/openshift/54e7963efcf933b7e2000037/app-root/runtime/repo//deployments: No such file or directory
remote: Starting wildfly cart
remote: Found 127.9.239.1:8080 listening port
remote: Found 127.9.239.1:9990 listening port
remote: /var/lib/openshift/54e7963efcf933b7e2000037/wildfly/standalone/deployments /var/lib/openshift/54e7963efcf933b7e2000037/wildfly
remote: /var/lib/openshift/54e7963efcf933b7e2000037/wildfly
remote: CLIENT_MESSAGE: Artifacts deployed: ./ROOT.war
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success

You can check my webapp code here: https://github.com/welovecoding/javeasy

The deployment can be seen on: http://www.javeasy.com/

Benny Code
  • 51,456
  • 28
  • 233
  • 198

1 Answers1

3

I found the problem. I had not defined the openshift profile in my pom.xml. Declaring the openshift profile solved my issue.

Here is my pom.xml as reference:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.javeasy</groupId>
  <artifactId>javeasy</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>war</packaging>

  <name>javeasy</name>

  <properties>
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.executable>${env.OPENSHIFT_WILDFLY_DIR}usr/lib/jvm/jdk1.8.0_05/bin/javac</maven.compiler.executable>
    <maven.compiler.fork>true</maven.compiler.fork>
  </properties>

  <dependencies>
    <dependency>
      <groupId>javax</groupId>
      <artifactId>javaee-api</artifactId>
      <version>7.0</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn. -->
      <!-- Use this profile for any OpenShift specific customization your app will need. -->
      <!-- By default that is to put the resulting archive into the 'deployments' folder. -->
      <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
      <id>openshift</id>
      <build>
        <finalName>jbosswildfly</finalName>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
              <failOnMissingWebXml>false</failOnMissingWebXml>
              <outputDirectory>deployments</outputDirectory>
              <warName>ROOT</warName>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>

And here is my .travis.yml:

# http://docs.travis-ci.com/user/workers/container-based-infrastructure/
sudo: false

# http://docs.travis-ci.com/user/languages/java/
language: java
jdk:
  - oraclejdk8

# http://docs.travis-ci.com/user/deployment/openshift/
deploy:
  provider: openshift
  user: me@mail.com
  password:
    secure: ...=
  app: jbosswildfly
  domain: welovecoding
  on:
    repo: welovecoding/javeasy

Application URL is: jbosswildfly-welovecoding.rhcloud.com

And GitHub repo is: https://github.com/welovecoding/javeasy

The .travis.yml has been created with the Travis command line client using these commands:

travis login
travis setup openshift -r welovecoding/javeasy

The parameter -r defines the GitHub repository.

Benny Code
  • 51,456
  • 28
  • 233
  • 198