Skip to content

Instantly share code, notes, and snippets.

@ScalaWilliam
Created November 19, 2013 09:41
Show Gist options
  • Save ScalaWilliam/7542822 to your computer and use it in GitHub Desktop.
Save ScalaWilliam/7542822 to your computer and use it in GitHub Desktop.
Put this in: C:\Programs..\Scala\bin\ Then run scala-project com.something.great Will create a scala project names 'great' in group 'com.something'. Depends on: https://github.com/davidB/scala-archetype-simple/
@echo off
setlocal EnableDelayedExpansion
set "groupId="
set "rest=%1"
set "f="
if "%rest" == "" goto bad
:bang
for /f "tokens=1* delims=." %%p in ("%rest%") DO (
if not "%f%" == "" if "%groupId%" == "" set "groupId=%f%"
if not "%f%" == "" if not "%groupId%" == "" set "groupId=%groupId%.%f%"
set "rest=%%q"
set "projectId=%%p"
set "f=%%p"
goto :bang
)
if "%groupId%" == "" goto bad
if "%projectId%" == "" goto bad
IF EXIST %projectId% goto :exists
call mvn archetype:generate -DarchetypeGroupId=net.alchim31.maven -DarchetypeArtifactId=scala-archetype-simple -DarchetypeVersion=1.6-SNAPSHOT -DgroupId="%groupId%" -DartifactId="%projectId%" -Dversion=0.1-SNAPSHOT -Dpackage="%groupId%" -DinteractiveMode=false
call cd "%projectId%"
goto :eof
:bad
echo Please enter a parameter in the form "<groupId>.<projectId>" without spaces.
goto :eof
:exists
echo File "%projectId%" seems to exist. Use a nonexisting file.
:eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment