DITA-OTでPDFが作れる環境を,7分で整える.
以前,mavenプラグイン作ったよと言った件.読み返すと
再現できねーよヴォケ
という気がしてきた.
そこで,珍しくstep by stepしてみる.まるでブログみたいだ.
maven2のインストール
OSXはXtoolsを入れればmaven2がインストールされる.その他の環境はよく判らない.また,maven2のインストールを詳しく説明しているサイトは腐る程あるので,省略.
setting.xml の既述.
mavenは,必要なプラグインを,web上に存在しているリポジトリから自動的にダウンロードしてくれる.ただし,何もせずにインストールされるプラグインは,セントラルリポジトリと呼ばれるサイトにあるものに限られる.
今回の環境は,セントラルレポジトリには無いので,明示的に位置を(mavenに)知らせる必要がある.
~/.m2/settings.xml を,下記のようにする.
<?xml version="1.0" encoding="UTF-8"?> <settings> <profiles> <profile> <id>dita-ot</id> <repositories> <repository> <id>foo</id> <url>http://download.pizzafactory.jp/repository/</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>foo</id> <url>http://download.pizzafactory.jp/repository/</url> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>dita-ot</activeProfile> </activeProfiles> </settings>
既にsettings.xmlがある場合は,内容をマージする必要がある.settings.xmlを既に持っているユーザは,マージの仕方も想像がつくだろうから,詳細省略.
archetype
archetype というのは,たぶん Maven 用語.他環境における,テンプレートとかウイザードとかいうものに近い.素のmavenはコマンドラインツールなので,archetypeの生成もコマンドライン.
$ mvn archetype:create -DarchetypeGroupId=jp.pizzafactory.documents.dita-ot -DarchetypeArtifactId=archetype-pdf -DarchetypeVersion=1.4.3.0 -DgroupId=com.example -DartifactId=hogehoge-pdf
groupIdとartifactIdは,ユーザの好きにしてよいが,最初の1回は,上記のとおりにするほうが安全.
実行したディレクトリに hogehoge-pdf というディレクトリがあるので,その中に移る.
$ cd hogehoge-pdf