Skip to content

Commit

Permalink
ISPN-3220 Include a maven-settings.xml Maven configuration file and a…
Browse files Browse the repository at this point in the history
… build.[sh|bat] script to get people started with building
  • Loading branch information
tristantarrant authored and Mircea Markus committed Jul 5, 2013
1 parent 87d3709 commit 9472dd1
Show file tree
Hide file tree
Showing 4 changed files with 256 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README-Maven.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
You can read more about how to build Infinispan using Maven in the documentation: https://docs.jboss.org/author/display/ISPN/Contributing+to+Infinispan#ContributingtoInfinispan-BuildingInfinispan
For convenience you can use the provided maven-settings.xml file which enables all additional repositories required for building Infinispan:

mvn -s maven-settings.xml clean install

or use the provided build.sh or build.bat depending on your platform of choice.

24 changes: 24 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@ECHO OFF

SETLOCAL ENABLEEXTENSIONS

IF DEFINED M2_HOME GOTO :CHECK_MVN

ECHO The M2_HOME environment has not been defined
GOTO :EOF

:CHECK_MVN

IF EXIST %M2_HOME%\bin\mvn.bat GOTO :RUN_MVN

ECHO Cannot find the mvn.bat executable in %M2_HOME%\bin
GOTO :EOF

:RUN_MVN
SET GOAL=%1
IF "%GOAL%"=="" SET GOAL=install

echo Running %M2_HOME%\bin\mvn.bat -s maven-settings.xml %GOAL% %2 %3 %4 %5 %6 %7 %8 %9

%M2_HOME%\bin\mvn.bat -s maven-settings.xml %GOAL% %2 %3 %4 %5 %6 %7 %8 %9

151 changes: 151 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#!/bin/bash

# $Id: build.sh 105735 2010-06-04 19:45:13Z pgier $

PROGNAME=`basename $0`
DIRNAME=`dirname $0`
GREP="grep"
ROOT="/"
MVN="mvn"

MAVEN_OPTS="$MAVEN_OPTS -Xmx768M"
export MAVEN_OPTS

# Use the maximum available, or set MAX_FD != -1 to use that
MAX_FD="maximum"

# OS specific support (must be 'true' or 'false').
cygwin=false;
darwin=false;
case "`uname`" in
CYGWIN*)
cygwin=true
;;

Darwin*)
darwin=true
;;
esac

#
# Helper to complain.
#
die() {
echo "${PROGNAME}: $*"
exit 1
}

#
# Helper to complain.
#
warn() {
echo "${PROGNAME}: $*"
}

#
# Helper to source a file if it exists.
#
source_if_exists() {
for file in $*; do
if [ -f "$file" ]; then
. $file
fi
done
}

say() {
if [ $darwin = "true" ]; then
# On Mac OS, notify via Growl
which -s growlnotify && growlnotify --name Maven --sticky --message "Infinispan build: $@"
fi
if [ `uname -s` == "Linux" ]; then
# On Linux, notify via notify-send
which notify-send && notify-send "Infinispan build: $@"
fi
}

ulimit_check() {
if [ $cygwin = "false" ]; then
HARD_LIMIT=`ulimit -H $1`
if [[ "$HARD_LIMIT" != "unlimited" && "$HARD_LIMIT" -lt "$2" ]]; then
warn "The hard limit for $1 is $HARD_LIMIT which is lower than the expected $2. This might be a problem"
else
SOFT_LIMIT=`ulimit -S $1`
if [[ "$SOFT_LIMIT" != "unlimited" && "$SOFT_LIMIT" -lt "$2" ]]; then
ulimit $1 $2
if [ $? -ne 0 ]; then
warn "Could not set ulimit $1 $2"
fi
fi
fi
fi
}

#
# Main function.
#
main() {
# If there is a build config file, source it.
source_if_exists "$DIRNAME/build.conf" "$HOME/.build.conf"

# Increase some limits if we can
ulimit_check -n 1024
ulimit_check -u 2048

# Setup some build properties
MVN_OPTS="$MVN_OPTS -Dbuild.script=$0"

# Change to the directory where the script lives, so users are not forced
# to be in the same directory as build.xml.
cd $DIRNAME

# Add smoke integration test directives before calling maven.
MVN_SETTINGS_XML_ARGS="-s maven-settings.xml"
MVN_GOAL="";
ADDIT_PARAMS="";
# For each parameter, check for testsuite directives.
for param in $@ ; do
case $param in
## -s .../settings.xml - don't use our own.
-s) MVN_SETTINGS_XML_ARGS=""; ADDIT_PARAMS="$ADDIT_PARAMS $param";;
-*) ADDIT_PARAMS="$ADDIT_PARAMS $param";;
clean) MVN_GOAL="$MVN_GOAL$param ";;
test) MVN_GOAL="$MVN_GOAL$param ";;
install) MVN_GOAL="$MVN_GOAL$param ";;
deploy) MVN_GOAL="$MVN_GOAL$param ";;
site) MVN_GOAL="$MVN_GOAL$param ";;
*) ADDIT_PARAMS="$ADDIT_PARAMS $param";;
esac
done
# Default goal if none specified.
if [ -z "$MVN_GOAL" ]; then MVN_GOAL="install"; fi

MVN_GOAL="$MVN_GOAL $TESTS"

# Export some stuff for maven.
export MVN_OPTS MVN_GOAL

# The default arguments. `mvn -s ...` will override this.
MVN_ARGS=${MVN_ARGS:-"$MVN_SETTINGS_XML_ARGS"};

echo "$MVN $MVN_ARGS $MVN_GOAL $ADDIT_PARAMS"

# Execute in debug mode, or simply execute.
if [ "x$MVN_DEBUG" != "x" ]; then
/bin/sh -x $MVN $MVN_ARGS $MVN_GOAL $ADDIT_PARAMS
else
$MVN $MVN_ARGS $MVN_GOAL $ADDIT_PARAMS
fi
if [ $? -eq 0 ]; then
say SUCCESS
else
say FAILURE
exit $?
fi
}

##
## Bootstrap
##
main "$@"

75 changes: 75 additions & 0 deletions maven-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/settings/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
<pluginGroup>org.jboss.maven.plugins</pluginGroup>
</pluginGroups>
<profiles>
<profile>
<id>jboss-public-repository</id>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>

<!-- Include early access of application server and other products -->
<profile>
<id>redhat-earlyaccess-repository</id>
<repositories>
<repository>
<id>redhat-earlyaccess-repository-group</id>
<name>Red Hat early access repository</name>
<url>http://maven.repository.redhat.com/earlyaccess/all/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>

</profiles>

<activeProfiles>
<activeProfile>jboss-public-repository</activeProfile>
<activeProfile>redhat-earlyaccess-repository</activeProfile>
</activeProfiles>

</settings>

0 comments on commit 9472dd1

Please sign in to comment.