m2

maven2 で wtp プロジェクトで困った場合

mvn eclipse:clean mvn -Dwtpversion=2.0 eclipse:eclipse maven2 をコマンドラインから使用して、eclipseの設定ファイルを再度生成しなおす。 eclipse上のmaven2プラグインは、偶に謎の挙動をする為 maven2 のコマンドラインに頼る方が簡単。

maven2 で plugin を作ってみる

こんなpomで <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>cc.aileron</groupId> <artifactId>samplemojo</artifactid></project>

javamail を依存性に登録する

<dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4.2</version> </dependency> <repository> <id>maven-repository.dev.java.net</id> <name>Java.net Maven Repository</name> <url>http://download.java.net/maven/2/</url> </repository> リポジトリ追加して、こんな依存性を追加すれば イケルぜ!!!

sun の依存性ライブラリの解決方法

<repository> <id>maven-repository.dev.java.net</id> <name>Java.net Maven Repository</name> <url>http://download.java.net/maven/2/</url> </repository> 上記リポジトリから取得する

実行可能jarの作り方

<plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass>メインクラス</mainClass> </manifest> </archive> </configuration> </plugin> mvn assembly:assembly

ソースディレクトリをmaven2にて追加する方法

<plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <id>add-source</id> <phase>compile</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>src/test/sql</source> </sources> </configuration> …</execution></executions></plugin></plugins>

maven2のdeploy @ windows の eclipse + m2eclipse

cygwin に ssh を入れる パッケージの選択から下記を選択 Net > openssh cygwin で ssh して対象サーバーにログインする cygwin のホームディレクトリ以下の .ssh/known_hosts を C:\Documents and Settings\{username}\.ssh にコピー setting.xmlの記述に追…