0

我从具有类似布局的项目中复制了以下插件并更新了相应的字段。我已经更改了确切的名称,但保留了包括“-”字符位置在内的格式。该项目在“目标”子目录中构建一个名为

artifact-id-1.4.3-standalone.jar

除非我弄错了,否则我相信部署插件中的参数引用了这个文件,并且该字段是从部署到同一个 repo 的另一个项目的直接复制/粘贴。但是我收到此错误:

[错误] 无法在项目 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 部署:部署文件

我已经尝试对工件的名称进行硬编码,删除所有替换,但这有同样的错误。我也尝试过环顾四周,并看到建议 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