0

同様のレイアウトのプロジェクトから次のプラグインをコピーし、適切なフィールドを更新しました。正確な名前を変更しましたが、「-」文字の配置を含む形式は保持されています。このプロジェクトは、「ターゲット」サブディレクトリに次の名前のアーティファクトをビルドします

アーティファクト-id-1.4.3-standalone.jar

私が間違っていない限り、展開プラグインのパラメーターはこのファイルを参照し、フィールドは同じリポジトリに展開する別のプロジェクトから直接コピー/貼り付けされていると思います。ただし、次のエラーが表示されます。

[エラー] プロジェクト kafka-mirror でゴール org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file (default-cli) を実行できませんでした: ゴール org のパラメーター 'file'、'url'。 apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file が見つからないか無効です

このコマンドを実行すると:

mvn -X deploy:deploy-file

すべての置換を削除してアーティファクトの名前をハードコーディングしようとしましたが、これには同じエラーがありました。私も周りを見回してみましたが、URL は jar があるフォルダーでなければならないという提案を見てきました。私もそれを試してみましたが、同じエラーが発生しましたが、他のすべての pom 間でそのフィールドを変更する必要がないため、これは正しくないと確信しています。deploy:deploy ゴールも使用してみましたが、別のエラーで失敗しました。このエラーはもともと Jenkins から発生しましたが、 deploy-file ゴールを呼び出そうとすることでローカル マシンに複製しました。さらに提案やアドバイスをいただければ幸いです。

以下に、pom プラグインの匿名バージョンを添付しました。

<plugin>
  <artifactId>maven-assembly-plugin</artifactId>
  <executions>
    <execution>
      <phase>package</phase>
      <goals>
        <goal>single</goal>
      </goals>
      <inherited>false</inherited>
      <configuration>
        <attach>false</attach>
        <appendAssemblyId>false</appendAssemblyId>
        <finalName>${project.artifactId}-${project.version}-standalone</finalName>
        <archive>
          <manifest>
            <mainClass>net.mycompany.mygroup.MyArtifact</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-deploy-plugin</artifactId>
  <executions>
    <execution>
      <id>executable-jar</id>
      <phase>deploy</phase>
      <goals>
        <goal>deploy-file</goal>
      </goals>
      <configuration>
        <repositoryId>mycompany-releases</repositoryId>
        <groupId>net.mycompany.mygroup</groupId>
        <artifactId>my-artifact-id</artifactId>
        <classifier>standalone</classifier>
        <version>${project.version}</version>
        <packaging>jar</packaging>
        <generatePom>false</generatePom>
        <updateReleaseInfo>true</updateReleaseInfo>
        <url>https://maven.mycompany.com/nexus/content/repositories/releases/</url>
        <file>target/${project.artifactId}-${project.version}-standalone.jar</file>
      </configuration>
    </execution>
  </executions>
</plugin>
4

0 に答える 0