Backend Development 3 min read

How to Seamlessly Add a Third‑Party SDK Jar to Your Maven Project

Learn a step‑by‑step method to integrate a third‑party SDK jar that isn’t in a Maven repository into your Java project by placing the jar in resources, adding a system‑scoped dependency, and configuring the build plugin to include it during packaging.

Lobster Programming
Lobster Programming
Lobster Programming
How to Seamlessly Add a Third‑Party SDK Jar to Your Maven Project

In many projects you may need to use a third‑party SDK that is provided only as a JAR and cannot be uploaded to a Maven repository.

Step 1: Place the third‑party JAR under src/main/resources (or a subdirectory such as src/main/resources/jar ).

Step 2: Add a system‑scoped dependency in pom.xml that points to the JAR file.

<code>&lt;dependency&gt;
    &lt;groupId&gt;taobao-sdk-java&lt;/groupId&gt;
    &lt;artifactId&gt;taobao-sdk-java&lt;/artifactId&gt;
    &lt;version&gt;1.0&lt;/version&gt;
    &lt;scope&gt;system&lt;/scope&gt;
    &lt;systemPath&gt;${project.basedir}/src/main/resources/jar/taobao-sdk-java.jar&lt;/systemPath&gt;
&lt;/dependency&gt;</code>

Step 3: Configure the Maven build plugin to include system‑scoped JARs when packaging.

<code>&lt;build&gt;
    &lt;finalName&gt;${project.artifactId}&lt;/finalName&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
            &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
            &lt;configuration&gt;
                &lt;fork&gt;true&lt;/fork&gt;
                &lt;!-- value true means include system‑scoped JARs --&gt;
                &lt;includeSystemScope&gt;true&lt;/includeSystemScope&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;</code>

After completing these steps the external SDK is packaged with the application and can be used like any other library.

JavaSDKMavenbuild pluginsystem scope
Lobster Programming
Written by

Lobster Programming

Sharing insights on technical analysis and exchange, making life better through technology.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.