Building and deploying java app with balenaos

am trying to deploy a Java application to my local openbalena, but am getting the following error

 balena deploy blinker --source . --logs

[Info]    Creating default composition with source: /Users/kameshs/MyLabs/iot/piker/led-blink
[Info]    Building for armv7hf/raspberrypi3
[Build]   Building services...
[Build]   main Preparing...
[Build]   Built 1 service in 0 seconds
[Error]   Deploy failed
Resolution could not be performed

Additional information may be available in debug mode. Prefix the command
line with DEBUG=1, i.e.:  DEBUG=1 balena ...
If you need help, don't hesitate in contacting our support forums at
https://forums.balena.io

For bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/

Not sure why its not able do docker build of java project.

the dockerfile used is

# TODO pre install pi4j 
FROM balenalib/%%BALENA_MACHINE_NAME%%-fedora-openjdk:8-28-run

WORKDIR /usr/src/app

COPY ./target/led-blink-runner.jar /usr/src/app/led-blink-runner.jar

ENV INITSYSTEM=on

CMD ["java", "-jar","led-blink-runner.jar"]

Could you please try with DEBUG=1 as the cli suggests:
DEBUG=1 balena deploy blinker --source . --logs
and paste the output here?

@zvin I was able to get past it with build and deploying to my device, on the way found potential issue on how balena cli handling builds https://github.com/balena-io/balena-cli/issues/1157

Am still confused on how the resolution is done? The following files in root?

  • package.json
  • Dockerfile
  • Dockerfile.template
  • docker-compose.yml
  • requirements.txt

Just my 2 cents
For Java I would suggest doing a scan of pom.xml or build.gradle

@kameshs currently balena deploy and balena push only understand the following:

  • package.json
  • Dockerfile
  • Dockerfile.template
  • docker-compose.yml

In the future we might add more language packs to make java, python, rust, etc easier to get started, but currently one needs to handle this via any of the 4 above options.

Thanks @shaunmulligan i resorted to using Dockerfile and things works well.

1 Like

Thats great to hear @kameshs, I also updated the documentation a bit on this, you can see it here now https://www.balena.io/docs/learn/deploy/deployment/#project-structure