I am deploying a python flask app to heroku which uses Zxing to read qr codes(scan them) and give out the data on them, however Zxing requires Java on the heroku environment.
Zxing : https://github.com/dlenski/python-zxing
Error with Zxing
barcode = reader.decode(f) #qrreader.data#
File "/app/.heroku/python/lib/python3.6/site-packages/zxing/__init__.py", line 48, in decode
raise BarCodeReaderException("Java binary specified does not exist", self.java, e)
zxing.BarCodeReaderException: ('Java binary specified does not exist', 'java', FileNotFoundError(2, "No such file or directory: 'java'"))
What I have Tried
Added the java buildpack to the environment along side python but that spits out an error and i am not sure if it would solve the problem either way.
the Java buildpack from heroku
heroku/java
Looked for other libraries that can do the same job with only python(found none)(zbar dependency issues)
My current build packs
https://github.com/survantjames/heroku-buildpack-poppler.git
heroku/python
https://github.com/heroku/heroku-buildpack-apt
All of this works on a local windows 10 environment with java installed and no other changes.
Is there a way to get Zxing working or is there an alternative that will work?
Thanks:D
EDIT: Java Build error details.(irrelevant, check below answer)
Rewrite package-config files
remote: -----> JVM Common app detected
remote: -----> Installing JDK 1.8... done
remote: -----> Java app detected
remote: -----> Using provided JDK
remote: -----> Installing Maven 3.6.2... done
remote: -----> Executing Maven
remote: $ mvn -DskipTests clean dependency:list install
remote: [INFO] Scanning for projects...
remote: [ERROR] [ERROR] Some problems were encountered while processing the POMs:
remote: [ERROR] 'modelVersion' is missing. @ line 1, column 9
remote: [FATAL] 'groupId' is missing. @ line 1, column 9
remote: [FATAL] 'artifactId' is missing. @ line 1, column 9
remote: [FATAL] 'version' is missing. @ line 1, column 9
remote: @
remote: [ERROR] The build could not read 1 project -> [Help 1]
remote: [ERROR]
remote: [ERROR] The project [unknown-group-id]:[unknown-artifact-id]:[unknown-version] (/tmp/build_7e2d7b50/pom.xml) has 4 errors
remote: [ERROR] 'modelVersion' is missing. @ line 1, column 9
remote: [ERROR] 'groupId' is missing. @ line 1, column 9
remote: [ERROR] 'artifactId' is missing. @ line 1, column 9
remote: [ERROR] 'version' is missing. @ line 1, column 9
remote: [ERROR]
remote: [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote: [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote: [ERROR]
remote: [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
remote:
remote: ! ERROR: Failed to build app with Maven
remote: We're sorry this build is failing! If you can't find the issue in application code,
remote: please submit a ticket so we can help: https://help.heroku.com/
remote:
remote: ! Push rejected, failed to compile Java app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to invoice-parser.
I have managed to solve my error by adding the buildpack
https://github.com/heroku/heroku-buildpack-jvm-common.git
in place of the java buildpack( EDIT: heroku/java) heroku provides, the buildpack i have used just installs jvm to my environment EDIT: which is also provided by heroku and is mentioned in link.
Zxing now builds fine :D
EDIT: There was confusion due to bad writing on my part but i do not at all mean that heroku does not provide these buildpacks. Me saying "in place" here shoud be taken in context of the question and as such it is in place of the original buildpack(heroku/java). It in no place or form means that heroku does not provide the buildpacks.
Thanks for pointing out the confusion