I have a simple app made in Spring Boot, Kotlin, Gradle. I followed the official tutorial and tried to follow all the possible defaults.
$ git push heroku master
Counting objects: 2, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 231 bytes | 231.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> JVM Common app detected
remote: -----> Installing JDK 1.8... done
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote:
remote: -----> Compressing...
remote: Done: 50.7M
remote: -----> Launching...
remote: Released v50
remote: https://---.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
It's weird that I get "JVM Common app detected" instead of "Gradle app detected".
I can't deploy the app. When I do heroku logs --tail, I get:
2018-04-02T23:02:39.257887+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -Dserver.port=50478 -jar build/libs/scraper-0.0.1-SNAPSHOT.jar`
2018-04-02T23:02:41.645544+00:00 heroku[web.1]: Process exited with status 1
2018-04-02T23:02:41.664910+00:00 heroku[web.1]: State changed from starting to crashed
2018-04-02T23:02:41.577966+00:00 app[web.1]: Error: Unable to access jarfile build/libs/scraper-0.0.1-SNAPSHOT.jar
2018-04-02T23:02:41.572483+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2018-04-02T23:05:10.000000+00:00 app[api]: Build started by user ---
2018-04-02T23:05:21.108667+00:00 app[api]: Release v50 created by user ---
2018-04-02T23:05:10.000000+00:00 app[api]: Build succeeded
2018-04-02T23:05:21.635834+00:00 heroku[web.1]: State changed from crashed to down
Using Spring Boot 2.0.0.RELEASE
Using Kotlin 1.2.31
no special tasks in build.gradle
no Procfile
Is there any way to fix this using the defaults (i.e.. no Procfile, no special Gradle tasks)? If not possible using defaults, what can I do? Thanks
You should indeed be getting (at least) the following:
remote: -----> Gradle app detected
remote: -----> Spring Boot detected
Is this the first push you did? Did you set a buildpack manually? Perhaps try clearing the buildpacks (heroku buildpacks:clear). If you can publish your app somewhere, it might help to check what the issue could be.
Related
-----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/java.tgz
Could not find a pom.xml file! Please check that it exists and is committed to Git.
More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
! Push failed
This is seen in Heroku's web app
This is my repo: https://github.com/ericntd/spring-boot-heroku-demo
I already have "image": "heroku/gradle" in app.json
The buildpack information can be found under Settings tab, the Framework section. (should be heroku/gradle).
Besure to remove heroku/java build pack if it's there (auto-detected and added by Heroku)
Alternative is to use the Heroku CLI and set the build pack desired (gradle)
My project "testheeroku7777" consist of two files.
main.go:
package main
import "fmt"
func main() {
fmt.Println("Hello world!")
}
Procfile:
web: testheeroku7777
When I push:
testheeroku7777> git push heroku master
It gives an error:
Counting objects: 8, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 645.21 KiB | 5.92 MiB/s, done.
Total 8 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> App not compatible with buildpack: https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/go.tgz
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to testheeroku7777.
remote: To https://git.heroku.com/testheeroku7777.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/testheeroku7777.git'
I've read provided links but I have no idea about this error.
This issue has to do with Go’s new dependency management system. Heroku is looking for a dependency management system in your project, and can’t find one. That’s why it’s throwing an error. Even though yours is a simple project, Heroku must have a dependency-management system that it can recognise.
Using Go modules is the officially-sanctioned method of dependency-management. But – and it’s a big but – a surprising quirk of Go modules is that Go modules don’t work for projects that are within the GOPATH.
When Go started, the developers made a big thing of having all projects in one place, the GOPATH. All the documentation was explicit on this – this is where your go code has to stored, it won’t run from anywhere else. But now, if you’re writing code that needs Go modules – and any code that’s going on heroku needs Go modules – the directories for that code must be outside GOPATH. I don’t know why they don’t make that more explicit, but that seems to be the way it is.
So, to get your code working, what you need to do is:
Move your project to somewhere outside GOPATH – the desktop, say,
in the name of originality.
Create a remote git repository with the same name as your current
project.
Then create a go module file by typing, at the terminal command
prompt in your local directory, go mod init
github.com/myGithubUserName/myProjectName
Next, create a local git repository by typing git init in the terminal.
Identify the remote repository you created earlier by typing git
remote add origin
http//www.github.com/myGithubUserName/myProjectName.git in the
terminal.
Write some excellent code.
Type git add . && git commit -m “first commit” at the prompt to
commit your code.
Type git push -u origin master to update the remote repository.
After all that, and only after all that, are you ready to type git push heroku master. The only consolation is that all should run smoothly now.
There are earlier dependency-management systems as mentioned by other posters, like govendor and dep, but Go modules are the officially-sanctioned method and I guess we’re all as well to adapt to it now as later. The most popular tutorial about Go modules seems to be this one: https://roberto.selbach.ca/intro-to-go-modules/. A search will find a few others too.
Heroku doesn't have the Go runtime installed in the base image, and therefore requires that you utilize the go buildpack to build your app. However, this also requires that you use a vendoring tool such as dep, or govendor, which means this very basic app, by itself, unfortunately won't work.
I have a scala + play (2.3) app, which I deploy on heroku. When there is no Procfile defined, the app deploys and runs without any problems (heroku detects that this is a scala play application). The slug size is 89MB
However, when I add a very simple Procfile:
web: target/universal/stage/bin/app_name -Dconfig.resource=application-heroku.conf
where application-heroku.conf is just a copy of my application.conf (I wanted to create separate application.confs for dev and prod)
the slug size increases to 380MB and the application fails to deploy (as the limit is 300MB).
Am I doing something wrong?
Something is preventing the buildpack from clearing out the build artifacts before preparing the slug. Do you see these lines in your build output:
-----> Dropping ivy cache from the slug
-----> Dropping sbt boot dir from the slug
-----> Dropping project boot dir from the slug
-----> Dropping compilation artifacts from the slug
If not, can you confirm that either
You have a conf/application.conf file in your project (even if you don't use it)
Or you have the sbt-native-packager dependency in your project/plugins.sbt
If neither of these is true, the buildpack cannot safe clear the build artifacts. If you do not have a conf/application.conf try adding one -- even if it's an empty place holder.
If you do see those "Dropping" lines in your build output, and are still getting a slug that is too big, then check that you are not using a custom buildpack (i.e. that your BUILDPACK_URL is not set).
I'm using heroku, play framework (v 2.2.1)
and IntelliJ IDEA as IDE.
Everything has already worked but when I added maven as framework support in IntelliJ, when I pushed again, my application wasn't recognized as a play app.
Here is my log when I push:
-----> Java app detected
-----> Installing OpenJDK 1.7... done
-----> Installing settings.xml... done
-----> executing /app/tmp/cache/.maven/bin/mvn -B -Duser.home=/tmp/build_78991f
d-32f6-43df-856c-f9059e8fa59d -Dmaven.repo.local=/app/tmp/cache/.m2/repository
s /app/tmp/cache/.m2/settings.xml -DskipTests=true clean install
[....]
[INFO] ------------------------------------------------------------------
------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------
------
[INFO] Total time: 2.387s
[INFO] Finished at: Tue Jan 07 14:57:19 UTC 2014
[INFO] Final Memory: 8M/514M
[INFO] ------------------------------------------------------------------
------
-----> Discovering process types
Procfile declares types -> web
-----> Compressing... done, 74.7MB
-----> Launching... done, v8
http://javaepidroid.herokuapp.com deployed to Heroku
To git#heroku.com:javaepidroid.git
f809301..b319499 master -> master
My app directory is in the root directory's repository.
Had anyone already has this kind of issue with heroku ?
As describe in this buildpack from github/heroku (for play2 apps) :
You need that your application is :
a sbt application, ie, one file matching one of these pathes :
root-app/*.sbt
root-app/project/*.scala
root-app/.sbt/*.scala
root-app/project/build.properties
a play application, ie. has this file : root-app/conf/application.conf
But you may also specify the buildpack of your heroku app :
$ heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-scala.git
As said in heroku documentation
I created a small app in play 2.0-RC2, but I can't push it to heroku. The error I'm getting is:
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] play:sbt-plugin:2.0-RC2 (sbtVersion=0.11.2, scalaVersion=2.9.1)
[warn]
[error] {file:/tmp/build_lhsutbwdl8uo/project/}default-be7cb3/*:update: sbt.ResolveException: unresolved dependency: play#sbt-plugin;2.0-RC2: not found
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? ! Failed to build app with SBT 0.11.0
! Heroku push rejected, failed to compile Scala app
I thought heroku just doesn't support play 2.0-RC2, but apparently James Ward succeeded pushing play 2.0-RC2 app to heroku :/ (http://www.jamesward.com/2012/02/21/play-framework-2-with-scala-anorm-json-coffeescript-jquery-heroku)
It looks like they broke something with the RC2 dependencies. I just updated an RC2 project to RC3 and it ran fine on Heroku. Just update the following line in project/plugins.sbt to update to RC3:
addSbtPlugin("play" % "sbt-plugin" % "2.0-RC3")