Deploying a Java project in Heroku without Maven dependencies

Does anyone work with Heroku for Java?

I have one Java project that I want to deploy to Heroku. This project uses some external JAR files that contain important dependencies.

Can someone tell me how to deploy my project with these JAR files to Heroku? Maven cannot upload these JAR files to Heroku.

+8
java maven heroku
source share
3 answers

We just published a guide showing how to add dependencies like this to a project:

http://devcenter.heroku.com/articles/local-maven-dependencies

Let me know if this works for you.

+7
source share

You need to set up a local Maven repository containing your banks. Enable this repo in your git repository. And add the repo to the pom.xml file:

 <repositories> <repository> <id>local-libs-dir</id> <name>locallib</name> <url>file:${project.basedir}/libs</url> </repository> </repositories> 

The jar files should be in the standard Maven repo layout and have md5 and sha1 checksums.

+2
source share

You can use jcabi-heroku-maven-plugin , which automates the entire deployment process:

 <plugin> <groupId>com.jcabi</groupId> <artifactId>jcabi-heroku-maven-plugin</artifactId> <version>0.4.1</version> <configuration> <name>my-test-app</name> <artifacts> <artifact>com.example:example-app:jar::${project.version}</artifact> </artifacts> <procfile>web: java -Xmx256m -jar ./example-app.jar \${PORT}</procfile> </configuration> <executions> <execution> <goals> <goal>deploy</goal> </goals> </execution> </executions> </plugin> 

In addition, you need to deploy the artifact (JAR / WAR) to your repository so that Maven inside Heroku can load it during deployment.

0
source share

All Articles