If your OpenShift app has dependencies on other Jars that are not publicly available in the usual maven repos (for example, other Jars from your own projects), you can push them to your remote Maven repo used when your app builds remotely.
Commit the jar in the root of your OpenShift project.
Edit .openshift/action_hooks/pre_build and add the following, updating Jar name etc:
mvn install:install-file --debug -Dfile=../../YourProjectName/runtime/repo/YourJarName.jar -DgeneratePom=true -DartifactId=YourArtifactName -Dversion=0.0.1-SNAPSHOT -DgroupId=your.group.id -Dpackaging=jar
Commit your changes and push to OpenShift – the jar will get installed to your remote repo, and now you can add a Maven dependency against it in your project’s pom.xml.
2 Replies to “Adding jars to your OpenShift remote Maven repo”
I am finding a problem in following your model: my JBossAS + mongodb project, while using maven, has no local runtime/repo folder: am I supposed to put the jar somewhere else (e.g., in the root of my local application) and let the git commit process send it into the (not local) runtime/repo folder? Thank you
Yes, commit your jar to the root of your local src project, and then when you push, it will end up in runtime/repo in your OpenShift app account online, which is at a file location relative to where the action_hook runs as ../..