diff --git a/build.sh b/build.sh new file mode 100755 index 0000000000..c6120f6506 --- /dev/null +++ b/build.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e + +eval $(etc/scripts/allocate-ports \ + JBOSS_MANAGEMENT_NATIVE_PORT \ + JBOSS_MANAGEMENT_HTTP_PORT \ + JBOSS_MANAGEMENT_HTTPS_PORT \ + JBOSS_AJP_PORT \ + JBOSS_HTTP_PORT \ + JBOSS_HTTPS_PORT \ + JBOSS_OSGI_PORT \ + JBOSS_REMOTING_PORT \ + JBOSS_TXN_RECOVERY_PORT \ + JBOSS_TXN_STATUS_PORT \ + SMTP_PORT \ +) +exec mvn "$@" diff --git a/etc/scripts/allocate-ports b/etc/scripts/allocate-ports new file mode 100755 index 0000000000..4b19b9a131 --- /dev/null +++ b/etc/scripts/allocate-ports @@ -0,0 +1,16 @@ +#!/bin/env groovy + +Map ports = [:] +List sockets = new ArrayList() +try { + for(String name: args) { + def s = new ServerSocket(0) + sockets.add(s) + ports[name] = s.localPort + } +} finally { + sockets*.close() +} + +ports.each { println "export ${it.key}=${it.value};" } +return