سؤال

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?

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


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!


partly solution for jUnit tests
using the maven-dependency-plugin and the maven-surefire-plugins one can make jUnits work. unfortunately, it does not solve the problem that the specific sapjco3.dll cannot be found when deployed within a war to a server.

<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 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>

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top