Search code examples
maventomcatopenshiftpom.xmlopenshift-3

Openshift 3 WAR


In the Openshift 2 I had such a profile in a pom.xml file:

    <profile>
        <!-- openshift red hat cloud build profile -->
        <id>openshift</id>
        <build>
            <finalName>${project.artifactId}</finalName>
            <plugins>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.1.1</version>
                    <configuration>
                        <outputDirectory>webapps</outputDirectory>
                        <warName>${project.artifactId}</warName>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

and this was responsible for putting a WAR file to directory from where it was automatically deployed to Tomcat-like-jboss.

Now - in Openshift 3 - by using browser-embeded ssh console I checked that WAR files were build and put into /tmp/src/webapps directory. Where should I move it (how should I modify the Maven profile) to make new Openshift 3 Tomcat-like-jboss deploy it and host it?


Solution

  • I've found the answear - the correct outputDirectory is target, so the WAR plugin looks now:

              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <outputDirectory>target</outputDirectory>
                      <warName>ROOT</warName>
                </configuration>
              </plugin>
    

    I've found it there: https://github.com/gshipley/book-helloworld/blob/master/pom.xml - in a sample OpenShift app. Now my WAR are being deployed to the WildFly!

    Moreover - this free e-book is really heplful: https://www.openshift.com/promotions/for-developers.html.