Skip to content

Instantly share code, notes, and snippets.

@aaronfc
Last active January 4, 2016 09:09
Show Gist options
  • Save aaronfc/8600587 to your computer and use it in GitHub Desktop.
Save aaronfc/8600587 to your computer and use it in GitHub Desktop.
Create libgdx project using maven (untested)
#!/bin/bash
# Install maven if required
hash mvn 2>/dev/null || hash brew 2>/dev/null && brew install maven || echo >&2 "Please, install maven before executing this. Aborting."; exit 1; }
# Install git if required
hash git 2>/dev/null || hash brew 2>/dev/null && brew install git || echo >&2 "Please, install git before executing this. Aborting."; exit 1; }
# Install libgdx-maven-archetype
git clone git://github.com/libgdx/libgdx-maven-archetype.git /tmp/libgdx-maven-archetype
cd /tmp/libgdx-maven-archetype
mvn install
# Move to initial folder
cd -
# Ask for information
echo "============================================================="
echo "Now you need to answer some questions ..."
echo "============================================================="
read -p "Maven groupId? (i.e: com.domain.tests) " $groupId
read -p "Maven artifactId? (i.e: testProject) " $artifactId
read -p "Package? (i.e: com.domain.tests.mycoolgame) " $package
echo "============================================================="
echo "Done! Now Maven's magic starts ...
echo "============================================================="
echo
# Let maven do its job
mvn archetype:generate -DarchetypeGroupId=com.badlogic.gdx -DarchetypeArtifactId=gdx-archetype -DarchetypeVersion=0.9.9 -DgroupId=$groupId -DartifactId=$artifactId -Dversion=1.0-SNAPSHOT -Dpackage=$package -DJavaGameClassName=Main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment