Deploy the maven webapp (java web) project on the Heroku platform, herokumaven

Source: Internet
Author: User

Deploy the maven webapp (java web) project on the Heroku platform, herokumaven

To deploy a java web project on Heroku, you must use maven to manage the project.

I. Create a maven webapp Project

Edit the pom. xml file and add the following Configuration:

<project xmlns="" xmlns:xsi=""         xsi:schemaLocation="">    <modelVersion>4.0.0</modelVersion>    <groupId>com.lala</groupId>    <artifactId>tangshiyi</artifactId>    <packaging>war</packaging>    <version>1.0.0</version>    <name>tangshiyi Maven Webapp</name>    <url></url>    <dependencies>        <dependency>            <groupId>junit</groupId>            <artifactId>junit</artifactId>            <version>4.11</version>            <scope>test</scope>        </dependency>        <dependency>            <groupId>javax.servlet</groupId>            <artifactId>javax.servlet-api</artifactId>            <version>3.0.1</version>            <scope>provided</scope>        </dependency>        <dependency>            <groupId>javax.servlet</groupId>            <artifactId>jsp-api</artifactId>            <version>2.0</version>            <scope>provided</scope>        </dependency>    </dependencies>    <build>        <finalName>jeecms</finalName>        <plugins>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-compiler-plugin</artifactId>                <version>3.3</version>                <configuration>                    <source>1.8</source>                    <target>1.8</target>                    <verbose>true</verbose>                </configuration>            </plugin>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-dependency-plugin</artifactId>                <version>2.10</version>                <executions>                    <execution>                        <phase>package</phase>                        <goals>                            <goal>copy</goal>                        </goals>                        <configuration>                            <artifactItems>                                <artifactItem>                                    <groupId>org.eclipse.jetty</groupId>                                    <artifactId>jetty-runner</artifactId>                                    <version>9.2.11.v20150529</version>                                    <destFileName>jetty-runner.jar</destFileName>                                </artifactItem>                            </artifactItems>                        </configuration>                    </execution>                </executions>            </plugin>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-war-plugin</artifactId>                <version>2.6</version>                <configuration>                    <warName>tangshiyi</warName>                </configuration>            </plugin>        </plugins>    </build></project>

Ii. Compile the command to run the war package

Create in the root directory of the project

Procfile file (note that the file name must be the same)

Web: java $ JAVA_OPTS-jar target/dependency/jetty-runner.jar -- port $ PORT target/tangshiyi. war

Note that the war package name must be the same as the one configured in pom. xml above.

3. Create the tangshiyi project on github and push the project just created

4. Create an application on heroku and associate it with the newly created Project on github. Just deploy the application.

V. Access

Https: // $ {xxxx}

$ {Xxxx} is the name of the application created in step 4.


Maven technical exchange group: 379165311. Welcome to join

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.