jboss-fuse / fuse-openshift-cartridge

an openshift cartridge for running Fuse and Fuse Fabric
Other
14 stars 25 forks source link

.m2/repository folders should be created from the cartridge #64

Closed cmoulliard closed 9 years ago

cmoulliard commented 9 years ago

When an artifact is not retrieved from the local Karaf system maven repository, our code is looking into .m2/repository which is not created by default on a gear machine

Could not find artifact : org.jboss.quickstarts.fuse:rest:jar:6.1.0.redhat-396 due to org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.jboss.quickstarts.fuse:rest:jar:6.1.0.redhat-396 from/to user (file:///var/lib/openshift/54ca05f57577e6d415001ca3/.m2/repository): Repository path /var/lib/openshift/54ca05f57577e6d415001ca3/.m2/repository does not exist, and cannot be created.

We should update the cartridge definition to create .m2 directory like also the repository folder and also perhaps create a settings.xml file pointing to that local directory too

Example :
~/.m2/settings.xml --> <localRepository>$OPENSHIFT_DATA_DIR</localRepository>
cmoulliard commented 9 years ago

I propose to add a new step called setup_maven to create what is missing into the gear/application with this script

cd $OPENSHIFT_DATA_DIR

M2_HOME="$OPENSHIFT_DATA_DIR/.m2"
export M2_HOME

mkdir -p $M2_HOME
mkdir -p $M2_HOME/repository

echo -e  "<settings>\n   <localRepository>$OPENSHIFT_DATA_DIR/.m2/repository</localRepository>\n</settings>\n" > $M2_HOME/settings.xml
cmoulliard commented 9 years ago

Advantage to have a local Maven repo is that a user can clone a project into the gear and upload it next into the Fuse Maven repo to install its own project or profiles