Deploying the Maven WebApp (Java Web) project on the Heroku platform

Source: Internet
Author: User

Currently, to deploy a Java Web project on top of Heroku, the project must be managed with Maven

A: New Maven WebApp Project

Edit the Pom.xml file and add the following configuration

<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi:s chemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > <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>http://maven.apache.org</url> <dependencies> <dependency&            Gt <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11&            lt;/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&gt    ;2.0</version> <scope>provided</scope> </dependency> </dependencies>                <build> <finalName>jeecms</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactid>maven-compiler-plugin</a rtifactid> <version>3.3</version> <configuration> &L T;source>1.8</source> <target>1.8</target> <verbose>true&                lt;/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>co                            Py</goal> </goals> <configuration> <artifactItems> <artifactItem> <group Id>org.eclipse.jetty</groupid> &LT;ARTIFACTID&GT;JETTY-RUNNER&LT;/ARTIFACTID&G                                    T <version>9.2.11.v20150529</version> <destfilename>jetty-runner.jar&lt ;/destfilename> </artifactItem> </artifactitems> </configuration> </execution> </exec utions> </plugin> <plugin> <groupId>org.apache.maven.plugins< /groupid> <artifactId>maven-war-plugin</artifactId> <version>2.6</ve                Rsion> <configuration> <warName>tangshiyi</warName> </configuration> </plugin> </plugins> </build></project>


Two: Write commands to run the war package

New at the root of the project

Procfile file (Note that the file name should be identical)


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


Note that the name of the war package here needs to be the same as the one configured in the pom.xml above.


Three: Create a Tangshiyi project on GitHub and push up the project you just created

Four: Create a new app on Heroku and associate it with the newly created project on GitHub, and deploy it

V: Visit

https://${xxxx}.herokuapp.com/

${XXXX} Create the name of the app for step fourth


---------------------------------------------------

Maven Technology Exchange Group: 379165311, Welcome to join us


Deploying the Maven WebApp (Java Web) project on the Heroku platform

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: info-contact@alibabacloud.com 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.