如何在依赖关系中使用具有不同文件名的artifactId [英] How to use artifactId with different filename in dependencies

查看:150
本文介绍了如何在依赖关系中使用具有不同文件名的artifactId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Artifactory和Maven,如何使用正确的组/ artifactId / version引用依赖关系,但是使用与artifactId-version.end样式不同的filname?

Using Artifactory and Maven, how can one refer to a dependency with the correct group/artifactId/version but use a filname that differs from the artifactId-version.end style?

问题出现在无法重命名的DLL中,而且是强制性的?人造命名约定

The problem comes with a dll that cannot be renamed, and the mandatory? Artifactory naming convention.

编辑

发现一种可能的昂贵方式对于文件名不能包含虚拟符号的特定问题:创建需要专业版本的新的Artifactory存储库布局 - 不幸的是,这不是一个选项!

edit
found one possible expensive way for this specific problem where the filename cannot include the dash-sign: creating a new Artifactory repository layout for which the pro-version is needed - so unfortunately, that is not an option!

部分解决方案jUnit测试

使用maven-dependency-plugin和maven-surefire-plugins可以使j工作不幸的是,它没有解决在战争中部署到服务器时找不到具体 sapjco3.dll 的问题。

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.3</version>
            <executions>
                <execution>
                    <id>copy</id>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>sapjco</groupId>
                                <artifactId>sapjco3</artifactId>
                                <version>3.0.7</version>
                                <type>dll</type>
                                <classifier>win32</classifier>
                                <overWrite>true</overWrite>
                                <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            </artifactItem>
                        </artifactItems>
                        <stripVersion>true</stripVersion>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <systemProperties>
                    <property>
                        <name>java.library.path</name>
                        <value>${project.build.directory}/lib</value>
                    </property>
                </systemProperties>
            </configuration>
        </plugin>
    </plugins>
</build>


推荐答案

Maven不关心文件名,坐标。将您的DLL正确添加到您的远程repo和maven将做其余的。
依赖关系代码段可能是:

Maven does not care for filenames, it cares for their coordinates. Add your DLL correctly to your remote repo and maven will do the rest. A dependency snippet might be:

<dependency>
  <groupId>com.company</groupId>
  <artifactId>my.artifact</atifactId>
  <version>1.0</version>
  <type>dll</type>
  <classifier>win32</classifier>
</dependency>

完成此操作后,请使用 依赖关系:copy-dependencies 或< a href =http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html =nofollow> 依赖关系:复制 在构建时更改文件名。

After you have done this, use either dependency:copy-dependencies or dependency:copy to change the filename at build time.

这篇关于如何在依赖关系中使用具有不同文件名的artifactId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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