RUN

1. using jetty:

1.1. quick developer mode -

    OVIRT_OPTIMIZER_CONFIG=/home/ovirt/ovirt-optimizer.properties \
    mvn jetty:run -pl ovirt-optimizer-jetty/

1.2. service mode (forked the bg, with debug port 5005 and 'stop' port 1353) -

    OVIRT_OPTIMIZER_CONFIG=/home/ovirt/ovirt-optimizer.properties \
    mvn -Prun -pl ovirt-optimizer-jetty/

#sample ovirt-optimizer.properties
org.ovirt.optimizer.sdk.protocol=http
org.ovirt.optimizer.sdk.server=dockerhost
org.ovirt.optimizer.sdk.port=8080
org.ovirt.optimizer.sdk.username=admin@internal
org.ovirt.optimizer.sdk.password=PASSWORD
org.ovirt.optimizer.sdk.ca.store=/etc/ovirt-optimizer/ovirt-optimizer.truststore

org.ovirt.optimizer.solver.steps=20
org.ovirt.optimizer.solver.timeout=30
org.ovirt.optimizer.solver.data.refresh=60
org.ovirt.optimizer.solver.cluster.refresh=300
#end of ovirt-optimizer.properties

a sample of the file is also under PROJECT-ROOT/ovirt-optimizer-core/src/main/resources


RELEASE

How to prepare a release:

1. update the version and changelog in the spec file:

1.1. change project_version and changelog in the spec
    - run
      mvn versions:set -DnewVersion=<new version>

2. run:
   git archive --format=tgz HEAD >ovirt-optimizer-{version}.tar.gz

BUILDING RPM

This shell script can be used to prepare a properly versioned RPM

sed -i -e 's/mvn --offline /mvn /g' ovirt-optimizer.spec

# downloads and installs the necessary jars
mvn help:evaluate -Dexpression=project.version 

# Prepare the version string (with support for SNAPSHOT versioning)
# $VERSION contains the version and ${VERSION[1]} the release if it is needed
VERSION=$(mvn help:evaluate -Dexpression=project.version 2>/dev/null | grep -v "^\[")
VERSION=${VERSION/-SNAPSHOT/-0.$(git rev-list HEAD --count).$(date +%04Y%02m%02d%02H%02M)}
IFS='-' read -ra VERSION <<< "$VERSION"

git archive --format=tar HEAD | gzip -9 >$HOME/rpmbuild/SOURCES/ovirt-optimizer-$VERSION.tar.gz
rpmbuild --define "_version $VERSION" --define "_release ${VERSION[1]-1}" -ba --nodeps ovirt-optimizer.spec

