1

1 つのモジュールが他のモジュールの影付きバージョンを表す Maven を使用してマルチモジュール プロジェクトを構築しています。


|- ベース
|- ベース シェーディング

モジュールにはすべてのbaseソース ファイルが含まれていますが、独自の名前空間にインポートしたい依存関係があります。このシェーディングされたモジュールは、base-shaded基本的に依存関係を構成する POM とbaseMaven Shade プラグインのみを含む私のモジュールによって記述されます。

これはうまくいきます。Shade プラグインにはすべての依存関係が含まれ、ソース アーティファクトを含むシェーディング アーティファクトが作成されます。ただし、javadocShade プラグインによって作成されたものではないアーティファクトがありません。したがって、baseモジュールの javadoc アーティファクトをコピーしようとしました。ただし、release:release目標はこれらのアーティファクトを無視するため、Maven Central にデプロイできません。それでも、これらのファイルをコピーしてインストールターゲットに含めることができました。

アセンブルされていないファイルをビルドに含める正規の方法はありますか? 私は間違ったアプローチかもしれないと考え始めます。

これが私のbase-shadedPOMのプラグイン構成です。大変申し訳ありませんが、最終的には 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>
4

1 に答える 1

0

もちろん、このタスク用のプラグインであるbuild-helper-maven-plugin.

于 2014-07-03T11:33:17.643 に答える