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> ;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> <ARTIFACTID>JETTY-RUNNER</ARTIFACTID&G T <version>9.2.11.v20150529</version> <destfilename>jetty-runner.jar< ;/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