1 つのモジュールが他のモジュールの影付きバージョンを表す Maven を使用してマルチモジュール プロジェクトを構築しています。
親
|- ベース
|- ベース シェーディング
モジュールにはすべてのbase
ソース ファイルが含まれていますが、独自の名前空間にインポートしたい依存関係があります。このシェーディングされたモジュールは、base-shaded
基本的に依存関係を構成する POM とbase
Maven Shade プラグインのみを含む私のモジュールによって記述されます。
これはうまくいきます。Shade プラグインにはすべての依存関係が含まれ、ソース アーティファクトを含むシェーディング アーティファクトが作成されます。ただし、javadoc
Shade プラグインによって作成されたものではないアーティファクトがありません。したがって、base
モジュールの javadoc アーティファクトをコピーしようとしました。ただし、release:release
目標はこれらのアーティファクトを無視するため、Maven Central にデプロイできません。それでも、これらのファイルをコピーしてインストールターゲットに含めることができました。
アセンブルされていないファイルをビルドに含める正規の方法はありますか? 私は間違ったアプローチかもしれないと考え始めます。
これが私のbase-shaded
POMのプラグイン構成です。大変申し訳ありませんが、最終的には Maven XML です。
<!-- Shade dependencies -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${version.plugin.shade}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>true</createDependencyReducedPom>
<dependencyReducedPomLocation>
${project.build.directory}/dependency-reduced-pom.xml
</dependencyReducedPomLocation>
<createSourcesJar>true</createSourcesJar>
<shadeSourcesContent>true</shadeSourcesContent>
<relocations>
<relocation>
<pattern>${shade.source}</pattern>
<shadedPattern>${shade.target}</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
<!-- Copy dependency version's javadoc artifacts -->
<plugin>
<groupId>com.github.goldin</groupId>
<artifactId>copy-maven-plugin</artifactId>
<version>${version.plugin.copy}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<resources>
<resource>
<targetPath>${project.build.directory}</targetPath>
<file>
${project.basedir}/../base/target/base-${project.version}-javadoc.jar
</file>
<destFileName>base-${project.version}-javadoc.jar</destFileName>
</resource>
<resource>
<targetPath>${project.build.directory}</targetPath>
<file>
${project.basedir}/../base/target/base-${project.version}-javadoc.jar.asc
</file>
<destFileName>base-shaded-${project.version}-javadoc.jar.asc</destFileName>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Because the javadoc files are copied manually, they must be installed manually as well -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>install-javadoc</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<classifier>javadoc</classifier>
<file>${build.directory}/base-shaded-${project.version}-javadoc.jar</file>
</configuration>
</execution>
<execution>
<id>install-javadoc-asc</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>jar.asc</packaging>
<classifier>javadoc</classifier>
<file>${build.directory}/base-shaded-${project.version}-javadoc.jar.asc</file>
</configuration>
</execution>
</executions>
</plugin>