Heroku not recognize gradle - Could not find a pom.xml file - gradle

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

Related

Deploying my Java Dynamic Web Project to Heroku

I've been trying to deploy a dynamic web project created in Eclipse to Heroku but I've been having a few difficulties. This project does not use a pom file/maven and does not seem to work with any of the java buildpacks that I try to use. I added a jvm buildpack and this appeared to help my project pass deployment, but when I try to open my app, I get the following error:
"Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail"
Is there a specific buildpack that I should use for this project?

Gitlab CI - Auto DevOps job failed, Unable to select a buildpack for a Go project?

My Gitlab CI Auto DevOps job failed with
Status: Downloaded newer image for gliderlabs/herokuish:latest
-----> Unable to select a buildpack
ERROR: Job failed: exit code 1
I've gone through
Auto DevOps and
Getting started with Auto DevOps
and am still not sure where I should put the buildpack.
Mine should be heroku-buildpack-go, which I've lost track where I get that from.
My repo consist only a single-character README.md, and the "Hello, playground" main.go.
Conclusion:
Thanks to David's comprehensive explanation, I was able to get DevOps started with correct buildpack:
From this I would conclude that your single .go file at the root of the directory tree does not meet the activation criteria for auto-building Go projects. I'd suggest picking one of the dependency managers in the requirements above and modifying your project to support it.
FTA, I just did touch go.mod then git add & git push and the AutoDevops started building my GO project indeed.
However it seems to me that Gitlab AutoDevops is not able to build any GO projects very easily, as I get the following error (with project variable TRACE=true):
...
!! The go.mod file for this project does not specify a Go version
!!
!! Defaulting to go1.11.1
!!
!! For more details see: https://devcenter.heroku.com/articles/go-apps-with-modules#build-configuration
!!
-----> Installing go1.11.1
-----> Fetching go1.11.1.linux-amd64.tar.gz... done
!! Installing package '.' (default)
!!
!! To install a different package spec add a comment in the following form to your `go.mod` file:
!! // +heroku install ./cmd/...
!!
!! For more details see: https://devcenter.heroku.com/articles/go-apps-with-modules#build-configuration
!!
-----> Running: go install -v -tags heroku .
go: cannot determine module path for source directory /tmp/build (outside GOPATH, no import comments)
ERROR: Job failed: exit code 1
The easier solution is to use .gitlab-ci.yml file instead, documented in
https://blog.boatswain.io/post/build-go-project-with-gitlab-ci/
(and followed up at Gitlab CI - Start Shared Runner for normal repos).
From the AutoDevops documentation:
Auto Build creates a build of the application in one of two ways:
If there is a Dockerfile, it will use docker build to create a Docker image.
Otherwise, it will use Herokuish and Heroku buildpacks to automatically detect and build the application into a Docker image.
Then looking at the build activation criteria, as per the Heroku Go buildpack documentation:
This buildpack will detect your repository as Go if you are using either:
go modules
dep
govendor
glide
GB
Godep
Or more specifically for godep, govendor or GB:
The Heroku Go buildpack is used when an application meets one of the following requirements:
has a Godeps/Godeps.json file, identifying the application as being managed by godep;
has a vendor/vendor.json file, identifying the application as being managed by govendor;
has a src directory, which has sub directories, contains one or more .go files, identifying the application as being managed by gb.
From this I would conclude that your single .go file at the root of the directory tree does not meet the activation criteria for auto-building Go projects. I'd suggest picking one of the dependency managers in the requirements above and modifying your project to support it. After that AutoDevops should start building your project.
If you are still having issues after that, this debugging note might help:
After making sure that the project meets the buildpack requirements;
if it still fails, setting a project variable TRACE=true will enable verbose logging which​ may help to continue troubleshooting.

Go application deployment in Bluemix fails

I am facing issues with pushing the sample Go applicaiton in Bluemix.
I will explain the steps I followed to push the applicaiton.
Created D:/goapp2016 and set it to GOPATH.
created src, pkg and bin folders in D:/goapp2016
In src, created "myapp" folder and written a sample app.go file.
Ran "go get" command inside GOPATH/src/myapp and that downloaded the libraries from Git in GOAPTH/src folder and mysql.a,native.a files in D:\goapp2016\pkg\windows_amd64\github.com\ziutek\mymysql. And myapp.exe is also created in GOPATH/bin after running go get command.
Ran "godep save" command which created Godeps/Godeps.json and vendor/(dependent libraries) folder in GOPATH/src/myapp.
To push the application to bluemix, I executed cf push command from GOPATH directory.
But, this is giving the below error.
-------> Buildpack version 1.7.5
file:///var/vcap/data/dea_next/admin_buildpacks/e57c0cd5-3b42-424d-ad32-b0bee17b
c1b0_a25a466217b64d5e4d47a6796be8ab23e7b7eeaf/dependencies/https___pivotal-build
packs.s3.amazonaws.com_concourse-binaries_godep_godep-v62-linux-x64.tgz
-----> Installing go1.6... done
Downloaded [file:///var/vcap/data/dea_next/admin_buildpacks/e57c0cd5-3b42-424d-a
d32-b0bee17bc1b0_a25a466217b64d5e4d47a6796be8ab23e7b7eeaf/dependencies/https___s
torage.googleapis.com_golang_go1.6.linux-amd64.tar.gz]
!
! Error: Cloud Foundry does not support the GB package manager
! We currently only support the 'Godep' package manager for go apps
! For support please file an issue: https://github.com/cloudfoundry/go- buildpack/issues
!
Staging failed: Buildpack compilation step failed
Directory Structure:
goapp2016/
bin/
godep.exe
myapp.exe
pkg/
windows_amd64/
github.com/
tools/
godep/
ziutek/
mymysql
src/
github.com/
ziutek/
myapp/
app.go
Godeps/
Godeps.json
vendor/
github.com/
ziutek/
manifest.yml
Procfile
Am I missing anything here?
The compile file for the buildpack can be seen here: https://github.com/cloudfoundry/go-buildpack/blob/master/bin/compile
Dependency tool selection begins on line 136, as long as there is a Godeps/Godeps.json file, the buildpack should used godeps, not GB. Are you sure you are pushing from the folder than contains the Godeps folder, that in turn contains the Godeps.json file?

Deploy WebSharper.Suave web application to Heroku

I can not understand what I need to change to make it.
I created a demo project from this blogpost with app.json and Procfile:
web: fsharpi-heroku WebsahrperSuaveHerokuExample1.sln
Next, I tried to deploy it to Heroku in accordance with these recommendations:
heroku create websahrper-with-suave-example --buildpack https://github.com/SuaveIO/mono-script-buildpack.git
heroku git:remote -a websahrper-with-suave-example
git push heroku master
There was an error in Heroku when building the project:
...
Import process completed.
-----> packages.config found, installing dependencies with nuget
Cannot open assembly 'install': No such file or directory.
! Push rejected, failed to compile SuaveFramework app
Could you suggest me a solution if there is one?
Have you tried here:
https://github.com/SuaveIO/heroku-getting-started
Fork it and click the Deploy to Heroku button.
Don't have the rep to comment on the above, but ademar's solution should cover as well as long as you don't have a file named "app.fsx"
The heroku buildpack checks to see if there is a script, then checks for a solution:
https://github.com/SuaveIO/mono-script-buildpack/blob/master/bin/compile#L66
Just make sure there is a .sln file in the project directory (can be empty, just needs to be present) or fork the buildpack and just make it default run mono $YOURPROJECT in the compile step.
When using an sln instead of a script, you need to change your Procfile to:
web: mono Path/execName.exe

Heroku Procfile increases slug size dramatically

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

Resources