2017-03-21 99 views
0

私はHerokuに展開したいSpring Webアプリケーションを持っています。ここでのpom.xmlです:ここではHerokuはwebapp-runner.jarを見つけることができません

<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> 

... 

<dependencies> 

    ...(spring, hibernate, junit, freemarker) 

</dependencies> 

<build> 

    <!-- static final name for easy integration with IDEs --> 
    <finalName>web-app</finalName> 

    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.6.0</version> 

      <configuration> 
       <source>1.8</source> 
       <target>1.8</target> 
      </configuration> 
     </plugin> 

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <version>2.3</version> 

      <configuration> 
       <warSourceDirectory>web</warSourceDirectory> 
      </configuration> 
     </plugin> 

     <!-- webapp-runner.jar for running the app --> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-dependency-plugin</artifactId> 
      <version>2.8</version> 
      <executions> 
       <execution> 
        <phase>package</phase> 
        <goals><goal>copy</goal></goals> 
        <configuration> 
         <artifactItems> 
          <artifactItem> 
           <groupId>com.github.jsimone</groupId> 
           <artifactId>webapp-runner</artifactId> 
           <version>8.5.11.2</version> 
           <destFileName>webapp-runner.jar</destFileName> 
          </artifactItem> 
         </artifactItems> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 


    </plugins> 
</build> 
</project> 

はProcfileは、プロジェクトのルートディレクトリにあります。

web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war 

すべてがローカルで結構です、と私は正常にHerokuのにそれを押してください。 Gitの出力:

remote: Compressing source files... done.   
remote: Building source:   
remote: 
remote: -----> JVM Common app detected   
remote: -----> Installing OpenJDK 1.8... done   
remote: -----> Discovering process types   
remote:  Procfile declares types -> web   
remote: 
remote: -----> Compressing...   
remote:  Done: 49.1M   
remote: -----> Launching...   
... 
remote: Verifying deploy... done.   

しかし、その後、Herokuのログが私に語った:

Error: Unable to access jarfile target/dependency/webapp-runner.jar 

私はProcfileで正確なコマンドをきれいにし、実行しようとした、すべてが私のローカルマシン上でうまく行きました。では、ここで何が問題になるのでしょうか?再び

$ heroku buildpacks:set heroku/java 

その後git push

答えて

1

を実行し、このコマンドは、あなたのbuildpackを変更します。

あなたのアプリはMavenを実行しないJVMビルドパックを使用しています。それはheroku deploy:warまたはHeroku Mavenプラグインを試したときにおそらくこのようになりました。

関連する問題