leftovers...

about grails groovy

Maven-Gaelyk Archetype v0.4.3 リリース! GaelykをMavenでサクッとね。

久しぶりにGaelykでもと思ったら。
maven-gaelykも公開されてました。
中身は、

  • Gaelyk 0.4.3
  • AppEngine 1.3.5
  • Groovy 1.7.4

maven-gaelyk公式サイト: http://code.google.com/p/maven-gaelyk/
Gaelyk公式サイト: http://gaelyk.appspot.com/

使い方。

  • ステップ1
mvn archetype:generate -DarchetypeRepository=http://maven-gaelyk.googlecode.com/svn/repository/ \
 -DarchetypeGroupId=com.codeconsole \
 -DarchetypeArtifactId=gaelyk-archetype -DarchetypeVersion=0.4.3 \
 -DartifactId=gaelykapp -DgroupId=com.appspot.gaelyk \
 -DgaeApplicationName=gaelykapp
  • ステップ2
cd gaelkyapp
  • ステップ3
mvn gae:run

起動したら http://localhost:8080/

  • デプロイは、
mvn gae:deploy

簡単ですね。

Spring-Securityテンプレート版ってのもあります。
gaelyk-security-archetype

 -DarchetypeArtifactId=gaelyk-security-archetype -DarchetypeVersion=0.4.0
mvn archetype:generate -DarchetypeRepository=http://maven-gaelyk.googlecode.com/svn/repository/ \
 -DarchetypeGroupId=com.codeconsole \
 -DarchetypeArtifactId=gaelyk-security-archetype -DarchetypeVersion=0.4.0 \
 -DartifactId=gaelykappss -DgroupId=com.appspot.gaelyk \
 -DgaeApplicationName=gaelykappss

少し古いので、一部自分で直す。
pom.xmlを開いて、3.0.3.CI-SNAPSHOTの箇所を3.0.3.RELEASEに変更。
ついでに、他も変更。まあ、いつか更新されるとおもいますが・・・。

<gaelyk.version>0.4.3</gaelyk.version>
<groovy.version>1.7.4</groovy.version> 
<gae.version>1.3.5</gae.version>
<springsecurity.version>3.0.3.RELEASE</springsecurity.version>
<gaeplugin.version>0.6.0</gaeplugin.version>
mvn gae:run

起動したら http://localhost:8080/admin をみる。
認証の定義等は、applicationContext-security.xml に書いてあるので参考にする。

<authentication-manager alias="authenticationManager">
  <!-- SHA-256 values can be produced 
     using 'echo -n your_desired_password | sha256sum' (using normal *nix environments) -->
  <authentication-provider>
    <password-encoder hash="sha-256"/>
    <user-service> 
      <user name="admin@gaelykapp.com" password="8c6976e......" authorities="ROLE_ADMIN"/>
      <!-- password is admin -->
      <user name="user@gaelykapp.com" password="04f8996da763b7a9....." authorities="ROLE_USER"/>
      <!-- password is user -->
    </user-service>
  </authentication-provider>
</authentication-manager>

URLの制御は、こんな感じ。

<intercept-url pattern="/admin/**" access="hasRole('ROLE_ADMIN')"/>
<intercept-url pattern="/**" access="permitAll" />

普通にSpring-Securityですね。