Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial (untested) preparations for running Java on Heroku using Ant

  • Loading branch information...
commit 363b1d7a807cb191a82ebb178c6186454014ac23 1 parent 9205474
Dennis Geurts authored
View
11 .project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>heroku-buildpack-ant</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
View
6 README.md
@@ -1,8 +1,8 @@
-Heroku buildpack: Java
+Heroku buildpack: Java (with Apache Ant)
=========================
This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpack) for Java apps.
-It uses Maven 3.0.3 to build your application and OpenJDK 1.6.0_20 to run it.
+It uses Apache Ant 1.8.3 to build your application and OpenJDK 1.6.0_20 to run it.
Usage
-----
@@ -12,7 +12,7 @@ Example usage:
$ ls
Procfile pom.xml src
- $ heroku create --stack cedar --buildpack http://github.com/heroku/heroku-buildpack-java.git
+ $ heroku create --stack cedar --buildpack http://github.com/dennisg/heroku-buildpack-ant.git
$ git push heroku master
...
View
57 bin/compile
@@ -8,68 +8,39 @@ BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
# parse args
BUILD_DIR=$1
CACHE_DIR=$2
+ANT_VER="1.8.3"
-KEEP_M2_CACHE="true"
-
-if [ ! -d $CACHE_DIR ]; then
- KEEP_M2_CACHE="false"
-elif [ -f $CACHE_DIR/removeM2Cache ]; then
- KEEP_M2_CACHE="false"
-fi
-
-if [ "true" == $KEEP_M2_CACHE ]; then
- logger -p user.notice -t "slugc[$$]" "language_pack_java retain_m2_repo"
-fi
+#if [ "true" == $KEEP_M2_CACHE ]; then
+# logger -p user.notice -t "slugc[$$]" "language_pack_java retain_m2_repo"
+#fi
#create the cache dir if it doesn't exist
mkdir -p $CACHE_DIR
-# change to cache dir to install maven
+# change to cache dir to install apache ant
cd $CACHE_DIR
-# install maven with base repository
-MAVEN_URL="http://s3.amazonaws.com/heroku-jvm-langpack-java/maven.tar.gz"
-
-if [ ! -d .maven ]; then
- echo -n "-----> Installing Maven 3.0.3....."
- curl --silent --max-time 60 --location $MAVEN_URL | tar xz
- chmod +x .maven/bin/mvn
- echo " done"
-fi
+# install ant with base repository
+ANT_URL="http://apache.mirror1.spango.com/ant/binaries/apache-ant-$ANT_VER-bin.tar.gz"
-MAVEN_SETTINGS_URL="http://s3.amazonaws.com/heroku-jvm-langpack-java/settings.xml"
-
-echo -n "-----> Installing settings.xml....."
-if [ -f .m2/settings.xml ]; then
- rm .m2/settings.xml
-fi
-curl --silent --max-time 10 --location $MAVEN_SETTINGS_URL --output .m2/settings.xml
+echo -n "-----> Installing Apache Ant $ANT_VER....."
+curl --silent --max-time 60 --location $ANT_URL | tar xz
+chmod +x apache-ant-$ANT_VER/bin/ant
echo " done"
-# change to build dir to run maven
+# change to build dir to run ant
cd $BUILD_DIR
-export MAVEN_OPTS="-Xmx512m"
+export ANT_OPTS="-Xmx512m"
# build app
-BUILDCMD="$CACHE_DIR/.maven/bin/mvn -B -Duser.home=$BUILD_DIR -Dmaven.repo.local=$CACHE_DIR/.m2/repository -s $CACHE_DIR/.m2/settings.xml -DskipTests=true clean install"
+BUILDCMD="$CACHE_DIR/apache-ant-$ANT_VER/bin/ant -Duser.home=$BUILD_DIR clean install"
echo "-----> executing $BUILDCMD"
$BUILDCMD 2>&1 | sed -u 's/^/ /'
if [ "${PIPESTATUS[*]}" != "0 0" ]; then
- echo " ! Failed to build app with Maven"
+ echo " ! Failed to build app with Ant"
exit 1
fi
-# finalize cache
-if [ "false" == $KEEP_M2_CACHE ]; then
- touch $CACHE_DIR/removeM2Cache
-fi
-
-#copy .m2 and .maven if needed
-if [ "true" == $KEEP_M2_CACHE ]; then
- for DIR in ".m2" ".maven" ; do
- cp -r $CACHE_DIR/$DIR $DIR
- done
-fi
View
4 bin/detect
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
# bin/use <build-dir>
-if [ -f $1/pom.xml ]; then
- echo "Java" && exit 0
+if [ -f $1/build.xml ]; then
+ echo "Java (using Ant)" && exit 0
else
echo "no" && exit 1
fi
View
2  bin/release
@@ -8,7 +8,7 @@ cat <<EOF
config_vars:
PATH: /usr/local/bin:/usr/bin:/bin
JAVA_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops
- MAVEN_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops
+ ANT_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops
addons:
shared-database:5mb
View
64 opt/settings-noproxy.xml
@@ -1,64 +0,0 @@
-<?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">
- <!-- localRepository
- | The path to the local mirror maven will use to store artifacts.
- |
- | Default: ~/.m2/mirror
- <localRepository>/path/to/local/repo</localRepository>
- -->
-
- <!-- interactiveMode
- | This will determine whether maven prompts you when it needs input. If set to false,
- | maven will use a sensible default value, perhaps based on some other setting, for
- | the parameter in question.
- |
- | Default: true
- <interactiveMode>true</interactiveMode>
- -->
-
- <!-- offline
- | Determines whether maven should attempt to connect to the network when executing a build.
- | This will have an effect on artifact downloads, artifact deployment, and others.
- |
- | Default: false
- <offline>false</offline>
- -->
-
- <!-- proxies
- | This is a list of proxies which can be used on this machine to connect to the network.
- | Unless otherwise specified (by system property or command-line switch), the first proxy
- | specification in this list marked as active will be used.
- |-->
- <proxies>
- <!-- proxy
- | Specification for one proxy, to be used in connecting to the network.
- |
- <proxy>
- <id>optional</id>
- <active>true</active>
- <protocol>http</protocol>
- <username>proxyuser</username>
- <password>proxypass</password>
- <host>proxy.host.net</host>
- <port>80</port>
- <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
- </proxy>
- -->
- </proxies>
-
- <!-- mirrors
- | This is a list of mirrors to be used in downloading artifacts from remote repositories.
- |
- | It works like this: a POM may declare a mirror to use in resolving certain artifacts.
- | However, this mirror may have problems with heavy traffic at times, so people have mirrored
- | it to several places.
- |
- | That mirror definition will have a unique id, so we can create a mirror reference for that
- | mirror, to be used as an alternate download site. The mirror site will be the preferred
- | server for that mirror.
- |-->
-
-</settings>
View
120 opt/settings-proxy.xml
@@ -1,120 +0,0 @@
-<?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">
- <!-- localRepository
- | The path to the local mirror maven will use to store artifacts.
- |
- | Default: ~/.m2/mirror
- <localRepository>/path/to/local/repo</localRepository>
- -->
-
- <!-- interactiveMode
- | This will determine whether maven prompts you when it needs input. If set to false,
- | maven will use a sensible default value, perhaps based on some other setting, for
- | the parameter in question.
- |
- | Default: true
- <interactiveMode>true</interactiveMode>
- -->
-
- <!-- offline
- | Determines whether maven should attempt to connect to the network when executing a build.
- | This will have an effect on artifact downloads, artifact deployment, and others.
- |
- | Default: false
- <offline>false</offline>
- -->
-
- <!-- proxies
- | This is a list of proxies which can be used on this machine to connect to the network.
- | Unless otherwise specified (by system property or command-line switch), the first proxy
- | specification in this list marked as active will be used.
- |-->
- <proxies>
- <!-- proxy
- | Specification for one proxy, to be used in connecting to the network.
- |
- <proxy>
- <id>optional</id>
- <active>true</active>
- <protocol>http</protocol>
- <username>proxyuser</username>
- <password>proxypass</password>
- <host>proxy.host.net</host>
- <port>80</port>
- <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
- </proxy>
- -->
- </proxies>
-
- <!-- mirrors
- | This is a list of mirrors to be used in downloading artifacts from remote repositories.
- |
- | It works like this: a POM may declare a mirror to use in resolving certain artifacts.
- | However, this mirror may have problems with heavy traffic at times, so people have mirrored
- | it to several places.
- |
- | That mirror definition will have a unique id, so we can create a mirror reference for that
- | mirror, to be used as an alternate download site. The mirror site will be the preferred
- | server for that mirror.
- |-->
- <mirrors>
- <!-- mirror
- | Specifies a mirror mirror site to use instead of a given mirror. The mirror that
- | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
- | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
- |
- -->
- <mirror>
- <id>centralMirror</id>
- <mirrorOf>central</mirrorOf>
- <name>central</name>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- </mirror>
- <mirror>
- <id>spring-maven-release</id>
- <mirrorOf>spring-maven-release</mirrorOf>
- <name>Spring Maven Release Repository</name>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- </mirror>
- <mirror>
- <id>spring-maven-milestone</id>
- <mirrorOf>spring-maven-milestone</mirrorOf>
- <name>Spring Maven Milestone Repository</name>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- </mirror>
- <mirror>
- <id>spring-roo-mirror</id>
- <mirrorOf>spring-roo-mirror</mirrorOf>
- <name>Spring Roo Repository</name>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- </mirror>
- <mirror>
- <mirrorOf>JBoss Repo</mirrorOf>
- <id>JBoss Repo</id>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- <name>JBoss Repo</name>
- </mirror>
- <mirror>
- <mirrorOf>com.force.maven.snapshot</mirrorOf>
- <id>com.force.maven.snapshot</id>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- <name>com.force.maven.snapshot</name>
- </mirror>
- <mirror>
- <mirrorOf>com.force.maven.release</mirrorOf>
- <id>com.force.maven.release</id>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- <name>com.force.maven.release</name>
- </mirror>
- <mirror>
- <mirrorOf>DataNucleus_2</mirrorOf>
- <id>DataNucleus_2</id>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- <name>DataNucleus_2</name>
- </mirror>
- </mirrors>
-
-</settings>
View
120 opt/settings.xml
@@ -1,120 +0,0 @@
-<?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">
- <!-- localRepository
- | The path to the local mirror maven will use to store artifacts.
- |
- | Default: ~/.m2/mirror
- <localRepository>/path/to/local/repo</localRepository>
- -->
-
- <!-- interactiveMode
- | This will determine whether maven prompts you when it needs input. If set to false,
- | maven will use a sensible default value, perhaps based on some other setting, for
- | the parameter in question.
- |
- | Default: true
- <interactiveMode>true</interactiveMode>
- -->
-
- <!-- offline
- | Determines whether maven should attempt to connect to the network when executing a build.
- | This will have an effect on artifact downloads, artifact deployment, and others.
- |
- | Default: false
- <offline>false</offline>
- -->
-
- <!-- proxies
- | This is a list of proxies which can be used on this machine to connect to the network.
- | Unless otherwise specified (by system property or command-line switch), the first proxy
- | specification in this list marked as active will be used.
- |-->
- <proxies>
- <!-- proxy
- | Specification for one proxy, to be used in connecting to the network.
- |
- <proxy>
- <id>optional</id>
- <active>true</active>
- <protocol>http</protocol>
- <username>proxyuser</username>
- <password>proxypass</password>
- <host>proxy.host.net</host>
- <port>80</port>
- <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
- </proxy>
- -->
- </proxies>
-
- <!-- mirrors
- | This is a list of mirrors to be used in downloading artifacts from remote repositories.
- |
- | It works like this: a POM may declare a mirror to use in resolving certain artifacts.
- | However, this mirror may have problems with heavy traffic at times, so people have mirrored
- | it to several places.
- |
- | That mirror definition will have a unique id, so we can create a mirror reference for that
- | mirror, to be used as an alternate download site. The mirror site will be the preferred
- | server for that mirror.
- |-->
- <mirrors>
- <!-- mirror
- | Specifies a mirror mirror site to use instead of a given mirror. The mirror that
- | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
- | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
- |
- -->
- <mirror>
- <id>centralMirror</id>
- <mirrorOf>central</mirrorOf>
- <name>central</name>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- </mirror>
- <mirror>
- <id>spring-maven-release</id>
- <mirrorOf>spring-maven-release</mirrorOf>
- <name>Spring Maven Release Repository</name>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- </mirror>
- <mirror>
- <id>spring-maven-milestone</id>
- <mirrorOf>spring-maven-milestone</mirrorOf>
- <name>Spring Maven Milestone Repository</name>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- </mirror>
- <mirror>
- <id>spring-roo-mirror</id>
- <mirrorOf>spring-roo-mirror</mirrorOf>
- <name>Spring Roo Repository</name>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- </mirror>
- <mirror>
- <mirrorOf>JBoss Repo</mirrorOf>
- <id>JBoss Repo</id>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- <name>JBoss Repo</name>
- </mirror>
- <mirror>
- <mirrorOf>com.force.maven.snapshot</mirrorOf>
- <id>com.force.maven.snapshot</id>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- <name>com.force.maven.snapshot</name>
- </mirror>
- <mirror>
- <mirrorOf>com.force.maven.release</mirrorOf>
- <id>com.force.maven.release</id>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- <name>com.force.maven.release</name>
- </mirror>
- <mirror>
- <mirrorOf>DataNucleus_2</mirrorOf>
- <id>DataNucleus_2</id>
- <url>http://maven-s3pository.herokuapp.com/all/</url>
- <name>DataNucleus_2</name>
- </mirror>
- </mirrors>
-
-</settings>
Please sign in to comment.
Something went wrong with that request. Please try again.