destFileName 被 mvn install dependency:copy-dependencies 忽略 [英] destFileName is ignored by mvn install dependency:copy-dependencies

查看:56
本文介绍了destFileName 被 mvn install dependency:copy-dependencies 忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用此命令复制依赖项时,我试图更改 jar 的本地文件夹和名称 mvn install dependency:copy-dependencies

destFileName 似乎被 maven 忽略了.尽管 outputDirectory 确实正确地将它放在该目录中,但 jar 名称并未更改 - 它与存储库中的名称相同.我想把jar复制下来的时候彻底改名

<modelVersion>4.0.0</modelVersion><!-- 未使用时需要--><groupId>aaaa</groupId><artifactId>aaaaa</artifactId><版本>5</版本><存储库><存储库><id>my-repo</id><name>repo</name><url>https://my-repo</url></repository></repositories><!-- 需要 uber-jar --><依赖项><依赖><groupId>com.mycompany.app</groupId><artifactId>my-app</artifactId><version>1.0-SNAPSHOT</version><classifier>uber-jar</classifier></依赖></依赖项><构建><插件><插件><artifactId>maven-dependency-plugin</artifactId><执行><执行><phase>process-sources</phase><目标><目标>复制依赖</目标></目标></执行></执行><配置><outputDirectory>罐子</outputDirectory><artifactItems><artifactItem><groupId>com.mycompany.app</groupId><artifactId>my-app</artifactId><classifier>uber-jar</classifier><overWrite>true</overWrite><!-- 这被忽略了--><destFileName>zzzzzz.jar</destFileName></artifactItem></artifactItems><overWriteReleases>true</overWriteReleases><overWriteSnapshots>true</overWriteSnapshots></配置></插件></plugins></build></项目>

解决方案

好吧我想我可能有答案 copy-dependencies 似乎没有 destFileName

复制依赖

但是目标副本有它

复制

我遇到了类似的问题,您可以尝试在复制依赖项中使用 选项

希望能帮到你

Im trying to change the local folder and name of a jar when copying down dependencies with this command mvn install dependency:copy-dependencies

destFileName seems to be ignored by maven. Although outputDirectory does correctly put it in that directory the jar name is not changed- it is the same name as it is in the repo. I want to completely change the name of the jar when it is copied down

<?xml version="1.0" encoding="UTF-8"?>

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <!-- required by not used -->
  <groupId>aaaa</groupId>
  <artifactId>aaaaa</artifactId>
  <version>5</version>

  <repositories>
    <repository>
      <id>my-repo</id>
      <name>repo</name>
      <url>https://my-repo</url>
    </repository>
  </repositories>

  <!-- require uber-jar -->
  <dependencies>
    <dependency>
      <groupId>com.mycompany.app</groupId>
      <artifactId>my-app</artifactId>
      <version>1.0-SNAPSHOT</version>
      <classifier>uber-jar</classifier>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <phase>process-sources</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <outputDirectory>Jars</outputDirectory>
          <artifactItems>
            <artifactItem>
              <groupId>com.mycompany.app</groupId>
              <artifactId>my-app</artifactId>
              <classifier>uber-jar</classifier>
              <overWrite>true</overWrite>


              <!-- THIS IS IGNORED -->
              <destFileName>zzzzzz.jar</destFileName>


            </artifactItem>
          </artifactItems>
          <overWriteReleases>true</overWriteReleases>
          <overWriteSnapshots>true</overWriteSnapshots>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

解决方案

Ok I think I may have the answer copy-dependencies seems to not have destFileName

copy-dependencies

but the goal copy has it

copy

I had a similar problem of your you could try to use the <stripVersion> options in the copy-dependencies

Hope it helps

这篇关于destFileName 被 mvn install dependency:copy-dependencies 忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆