Scala2.8 と Lift2.2 のアーキタイプを M2Eclipse 上に import する
Scalaの勉強を始めました。
Liftで何か作ろうとアーキタイプを作成したんですが、どはまりしたのでメモを残しておきます。
mvn archetype:generate \ -DarchetypeGroupId=net.liftweb \ -DarchetypeArtifactId=lift-archetype-basic_2.8.1 \ -DarchetypeVersion=2.2 \ -DarchetypeRepository=http://scala-tools.org/repo-releases \ -DremoteRepositories=http://scala-tools.org/repo-releases \ -DgroupId={groupId} \ -DartifactId={articfactId} \ -Dversion=1.0
まずは maven で Lift2.2 Scala2.8.1 用のアーキタイプを生成
File > Import... > Maven Existing Maven Projects
できたフォルダをEclipseからimport
そうするとなぜかJavaプロジェクトとしてプロジェクトが作成されるため、buildが成功しません。
なので一度Eclipseを終了させ、
.projectファイルをエディタで開き
変更前
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>${artifactId}</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.maven.ide.eclipse.maven2Builder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.maven.ide.eclipse.maven2Nature</nature> </natures> </projectDescription>
変更後
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>${artifactId}</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.scala-ide.sdt.core.scalabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.maven.ide.eclipse.maven2Builder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.scala-ide.sdt.core.scalanature</nature> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.maven.ide.eclipse.maven2Nature</nature> </natures> </projectDescription>
というように書き換える。
力技すぎますね……。
もっと上手い方法は無いものでしょうか。