Reputation: 205
I am trying to deploy a dropwizard app on heroku which fails to launch. Its works fine locally using "gradle run server config.yml"
I am using gradle for build and when I push to heroku the build is successful. My gradle stage task dependsOn clean and jar(fat jar creation)
My Procfile has:
web: java $JAVA_OPTS -jar dropwizard-app/build/libs/dropwizard-app.jar server dropwizard-app/config.yml
The above fails with "Unable to access jarfile dropwizard-app/build/libs/dropwizard-app.jar"
I have tried unsuccessfully with
web: java $JAVA_OPTS -jar build/libs/dropwizard-app.jar server config.yml
I have also tried to execute using gradle command
web: gradle run server config.yml
This gives an error bash: gradle command not found
My gradle tasks are as follows:
task stage(dependsOn: ['clean', 'jar'])
run {
args 'server', 'config.yml'
}
jar {
manifest {
attributes 'Title': 'dropwizard-app', 'Version': version,'Main-Class': mainClassName
}
archiveName 'dropwizard-app'
dependsOn configurations.runtime
from {
configurations.compile.collect {it.isDirectory()? it: zipTree(it)}
}
}
Am I missing out something here? How do I launch my dropwizard application?
Upvotes: 1
Views: 1537
Reputation: 205
Got it working.
As mentioned above I was trying to execute dropwizard-app.jar but the jar created on heroku was not of mentioned name, it took the default archive name starting with build-'some autogenerated value'.jar
So I added a settings.gradle to my project:
rootProject.name = 'dropwizard-app'
Now the jar created was dropwizard-app-1.0.jar
as I have set the version attribute to 1.0 in build.gradle
I used heroku run bash
to check the files on heroku
Upvotes: 7
Reputation: 7257
I wrote a Maven-based deployment guide describing how to deploy a Dropwizard to Heroku which may offer some help. While it doesn't cover gradle, it does point out some common gotchas with the Heroku environment.
For example, your Procfile should look like this:
web java $JAVA_OPTS -Ddw.http.port=$PORT -Ddw.http.adminPort=$PORT -jar path/to/dw/module/target/example-develop-SNAPSHOT.jar server path/to/dw/module/config-heroku.yml
Upvotes: 0