Search code examples
javamavenjarartifactory

Pull all artifacts from Maven Artifactory instead of just JAR artifacts


I have published a library to artifactory with the following artifacts and structure:

test-1.3-20191219-1-jar-with-dependencies.jar
test-1.3-20191219-1-jar-with-dependencies.jar.md5
test-1.3-20191219-1-jar-with-dependencies.jar.sha1
test-1.3-20191219-1-javadoc.jar
test-1.3-20191219-1-javadoc.jar.md5
test-1.3-20191219-1-javadoc.jar.sha1
test-1.3-20191219-1.bin
test-1.3-20191219-1.bin.md5
test-1.3-20191219-1.bin.sha1

When I pull from artifactory, I only see these jar artifacts inside my m2 folder:

_remote.repositories
test-1.3.jar
test-1.3.jar.sha1

I don't see the .bin artifact being pulled in

Here is my POM:

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

    <groupId>com.github.test</groupId>
    <artifactId>test.client</artifactId>
    <version>1.3</version>

    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <jdk.version>1.7</jdk.version>

        <log4j.version>1.7.12</log4j.version>

        <junit.version>4.11</junit.version>

        <es.version>2.3.2</es.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <inherited>true</inherited>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>com.github.test</groupId>
            <artifactId>test</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>javacpp</artifactId>
            <version>1.3.1</version>
        </dependency>
    </dependencies>
       <repositories>
        <repository>
        <id>my-test-repository</id>
        <name>my-test</name>
        <url>artifactory-url</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    </repositories>
</project>

What do I need to modify in my POM to pull all the artifacts from artifactory?


Solution

  • A dependency without a <type> has <type>jar</type> implicitly. To download other artifacts you need to add entries like <type>bin</type> to your dependency, like

    <dependency>
        <groupId>com.github.test</groupId>
        <artifactId>test</artifactId>
        <version>1.3</version>
        <type>bin</type>
    </dependency>