Maven を使用してマルチモジュール スタンドアロン アプリケーションを作成したいと考えています。
私の場合、「ローダー」プロジェクト (.jar) に他のすべてのプロジェクトを含めたいと思います。しかし、今は .jar ファイルのセット (loader.jar、crawler1.jar ... など) があります。
ローダーの .pom :
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.javanix.jmetalcrawler</groupId>
<artifactId>loader</artifactId>
<version>1.0</version>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
サブプロジェクトの .pom :
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.javanix.jmetalcrawler</groupId>
<artifactId>Crawler-1</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>com.javanix.jmetalcrawler</groupId>
<artifactId>loader</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
親の .pom :
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.javanix.jmetalcrawler</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>jMetalCrawler</name>
<modules>
<module>Crawler-1</module>
<module>Loader</module>
</modules>
</project>
ライフサイクル:
- 「ローダー」をコンパイルします(インターフェース/抽象クラスがあります)
- 'crawler1' をコンパイル/パッケージ化します ('Loader' プロジェクトに依存するため)
- 'crawler2' をコンパイル/パッケージ化します ('Loader' プロジェクトに依存するため)
- コンパイル済みの「クローラー」プロジェクトを含むパッケージ ローダー
PS :
- Adrian Shum のおかげで、彼は私のプロジェクトをより明確にするためのアイデアを与えてくれました
- 「Launcher」プロジェクトでプロジェクトを再構築した後、
maven-assembly-plugin
(@see http://rombertw.wordpress.com/2010/05/14/maven-recipe-building-an-aggregate-jar/を参照)を介して依存関係を追加できます。