私はMavenを初めて使い、自分の会社のビルドを作成しています。 Mavenセントラルリポジトリに接続する必要はなく、srcとtestコードのディレクトリ構造はsuper pomで指定されているものとは異なります。私はこれを処理する最善の方法は、顧客のスーパーポンムを作成することだと思ったが、私は本当にスーパーポンを入れてプロジェクトポムを参照することができますか?それはどこかのレポジトリに入っていますか?もしそうなら、どこ?Maven Super POM
おかげで、 ジェフ
私はMavenを初めて使い、自分の会社のビルドを作成しています。 Mavenセントラルリポジトリに接続する必要はなく、srcとtestコードのディレクトリ構造はsuper pomで指定されているものとは異なります。私はこれを処理する最善の方法は、顧客のスーパーポンムを作成することだと思ったが、私は本当にスーパーポンを入れてプロジェクトポムを参照することができますか?それはどこかのレポジトリに入っていますか?もしそうなら、どこ?Maven Super POM
おかげで、 ジェフ
私の提案は、あなたのプロジェクトは、あなたの設定を導き出すことができ、そこから親POMを作成することです。この親POMは単純に別のMaven 2プロジェクトですが、 "jar"の代わりに "pom"型を使用しています。あなたが親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">
<parent>
<artifactId>projectname</artifactId>
<groupId>com.company.projectname</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>child-project</artifactId>
<packaging>jar</packaging>
<name>child-project</name>
<description>
My child project
</description>
</project>
すべてが以下のようになります。このようになります。
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.company.projectname</groupId>
<artifactId>projectname</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>projectname</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<superprop1>this property is available in all child projects</superprop1>
<superprop2>this property is available in all child projects</superprop2>
<superprop3>this property is available in all child projects</superprop3>
</properties>
</project>
とプロジェクトの子:
たとえば、次のような親ポンポンを持っている可能性があり子供のポンで利用可能です。 aboutの例では、子プロジェクトは自動的にJUnit依存関係を利用できます。このようにすることで、各開発者がMavenインストールのスーパーPOMを使いこなす必要がある場合と比較して、環境が自動的に計算されるようになります。
おそらく正しいですが、この状況ではスーパーポッドが手に入ります。どこに置くかについては、ローカルのMavenリポジトリを作成し、開発者がそこにアクセスできるようにする必要があります。ここではいくつかの便利な(そして無料)プログラムは、以下のとおりです。
たら、リポジトリを稼働させる場合は、各開発者にsettings.xmlを変更して、設定した新しいリポジトリサーバを参照させる必要があります。作成したスーパーポームはリポジトリにデプロイされるので、使用するように設定されると、mavenはスーパーポームを自動的にプルダウンします。
<?xml version="1.0" encoding="UTF-8"?> <settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <profiles> <profile> <repositories> <repository> <snapshots> <enabled>false</enabled> </snapshots> <id>central</id> <name>all</name> <url>https://server.mycompany.com/artifactory/all</url> </repository> <repository> <snapshots /> <id>snapshots</id> <name>all</name> <url>https://server.mycompany.com/artifactory/all</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <snapshots> <enabled>false</enabled> </snapshots> <id>central</id> <name>all</name> <url>https://server.mycompany.com/artifactory/all</url> </pluginRepository> <pluginRepository> <snapshots /> <id>snapshots</id> <name>all</name> <url>https://server.mycompany.com/artifactory/all</url> </pluginRepository> </pluginRepositories> <id>artifactory</id> </profile> </profiles> <activeProfiles> <activeProfile>artifactory</activeProfile> </activeProfiles> </settings>:ここ はartifactory生成されたsettings.xmlファイルの例です。