修改pom文件以进行heroku部署

时间:2019-03-24 18:23:26

标签: java eclipse maven heroku pom.xml

我正在尝试将Eclipse jee动态Web应用程序部署到heroku。我需要修改pom文件,但不确定如何。

这是我需要添加的内容,但我不确定放置在何处:

<configuration>
   <appName>gentle-shore-6874</appName>
</configuration>

这是eclipse中的文件:

<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <version>1.0-SNAPSHOT</version>
  <artifactId>helloworld</artifactId>
  <packaging>war</packaging>

  <dependencies>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <version>9.4.7.v20170914</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>com.heroku.sdk</groupId>
        <artifactId>heroku-maven-plugin</artifactId>
        <version>2.0.7</version>
        <configuration>
          <buildpacks>
            <buildpack>heroku/exec</buildpack>
            <buildpack>heroku/metrics</buildpack>
            <buildpack>heroku/jvm</buildpack>
          </buildpacks>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

1 个答案:

答案 0 :(得分:1)

<modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <version>1.0-SNAPSHOT</version>
  <artifactId>helloworld</artifactId>
  <packaging>war</packaging>

  <dependencies>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <version>9.4.7.v20170914</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>com.heroku.sdk</groupId>
        <artifactId>heroku-maven-plugin</artifactId>
        <version>2.0.7</version>
        <configuration>

           <appName>gentle-shore-6874</appName>

          <buildpacks>
            <buildpack>heroku/exec</buildpack>
            <buildpack>heroku/metrics</buildpack>
            <buildpack>heroku/jvm</buildpack>
          </buildpacks>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>